The syntax for creating a table in MySQL is: CREATE TABLE table_name (column_name1 data_type, column_name2 data_type, ...); where table_name is the table name, column_name# is the column name, and data_type is the column data type.
Title: How to create a MySQL table
Answer:
In MySQL The basic syntax for creating a table in is as follows:
<code>CREATE TABLE table_name ( column_name1 data_type, column_name2 data_type, ... );</code>
Detailed description:
Example:
Suppose you want to create a table namedstudents with the following columns:
(INT) - The student's unique ID
(VARCHAR(255)) - The student's name
(INT) - The age of the student
<code>CREATE TABLE students ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(255) NOT NULL, age INT NOT NULL );</code>
Notes:
,
FOREIGN KEY, and
UNIQUE.
The above is the detailed content of How to create a table in mysql. For more information, please follow other related articles on the PHP Chinese website!