In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use SQL statements to create tables, 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 learn about it!
The statement to create the table in the sql statement is "CREATE TABLE", and the specific syntax format is "CREATE TABLE table name ([table definition option]) [table option] [partition option];"; where "[table definition option]" is in the format "column name 1 type 1 [, …] column name n type n".
Recommended tutorial: mysql Video tutorial
In MySQL, you can use CREATE TABLE statements to create tables.
The syntax format is:
CREATE TABLE table name ([table definition options]) [table options] [partition options]
The format of "Table definition options" is:
Column name 1, type 1 [,...] Column name n type n
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
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.
Example: select the database test_db that creates the table, and create the tb_emp1 data table
Mysql > USE test_db;Database changedmysql > CREATE TABLE tb_emp1-> (- > id INT (11),-> name VARCHAR (25),-> deptId INT (11),-> salary FLOAT->); Query OK, 0 rows affected (0.37 sec)
Check to see if the datasheet was created successfully:
Mysql > SHOW TABLES;+-+ | Tables_in_test_db | +-+ | tb_emp1 | +-+ 1 rows in set (0.00 sec) above is all the contents of the article "how to create a table using SQL statements". 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.