basic creation of a table
create TABLE userinfo (
username char (5) Not NULL,
pwd VARCHAR (
age
Sex SMALLINT(100)
)
The blue representation is the keyword in SQL CREATE TABLE userinfo is the table name and the field is created in such a way as username CHAR(5), c11>username The data type of the field that represents the second bit after the field name is the field length in parentheses, not NULL
Renaming a table
RENAME TABLE ' user ' to NewUser
Change the user table to be named NewUser table
Deletion of tables
DROP TABLE newuser
Remove the name of the user table from the database
Add a new field to the table
ALTER TABLE userinfo ADD Hobby char (a) not NULL
Add a userinfo table with a new field for hobby and also set the type of the data
Renaming columns in a table
ALTER TABLE UserInfo Change username newname VARCHAR (+)
Update the username field named UserInfo table to the new field name for NewName and specify the data type of the field
Basic operation of tables in MySQL