In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how to create mysql table, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!
In mysql, you can use the "CREATE TABLE" statement to create a table in the syntax format "create table table name (column name data type);". The "CREATE TABLE" statement is used to create tables in the database, and the data type specifies what data type the column can hold.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
In MySQL, you can use CREATE TABLE statements to create tables. Its grammatical format is:
CREATE TABLE ([Table definition options]) [Table options] [Partition options]
The format of "Table definition options" is:
[,...]
There are many syntax for CREATE TABLE command, which is mainly composed of table creation definition (create-definition), table option (table-options), and partitioning option (partition-options).
Here we first describe a simple example of creating a new table, and then focus on some of the main syntax points in the CREATE TABLE command.
The main syntax and usage instructions of the CREATE TABLE statement are as follows:
CREATE TABLE: used to create a table with a given name, you must have permission for the table CREATE.
Specifies the name of the table to be created, given after CREATE TABLE, and must conform to the naming convention for identifiers The table name is specified as db_name.tbl_name to create the table in a specific database. It can be created in this way, regardless of whether there is a current database or not. You can omit db-name when you create a table in the current database. If you use a quoted distinguished name, the database and table names should be in quotation marks, respectively. For example, 'mydb'.'mytbl' is legal, but' mydb.mytbl' is illegal.
A table creation definition consisting of a column name (col_name), a column definition (column_definition), and a possible null value description, integrity constraint, or table index By default, the table is created into the current database. An error occurs if the table already exists, there is no current database, or the database does not exist.
Tip: when you create a table using CREATE TABLE, you must specify the following information:
The name of the table to be created is case-insensitive and cannot use keywords in the SQL language, such as DROP, ALTER, INSERT, and so on. The name and data type of each column (field) in the data table. If you create multiple columns, separate them with commas.
Create table Student (- > Sno int not null auto_increment primary key,-> Sname varchar (10) not null,-> Sex char (1) not null,-> Sage tinyint (100) not null,-> Sdept char (4) not null) comment = 'Student Table'. The above is all the contents of the article "how to create a Table by mysql". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.