How to use SQL create table statement in a database?
CREATE TABLE is used to create a new table in a database with SQL.
The basic grammar is as follows:
Create a table with the name “表名” that includes columns with their respective data types.
In this case, the table name represents the name of the table to be created, the column names represent the names of the columns for the table to be created, and the data types represent the data type of each column.
Here is an example:
Please create a table for students with columns for ID (integer format, primary key), name (up to 50 characters), age (integer format), and gender (up to 10 characters).
In the example above, we created a table called students, which includes columns for id, name, age, and gender. The data type for the id column is INT, while the name and gender columns have a data type of VARCHAR, and the age column is also of data type INT. Additionally, the id column is designated as the primary key.
You can define more columns according to your own needs and specify the appropriate data type for each column.