After the cmd command to enter the database, you need to manually do some operations on the database
Create a database plus a semicolon
MySQL>Createdatabase myfirstdatabase;
View the database you created plus s and semicolons
MySQL>show Databases;
Select the database plus semicolon to use
MySQL> use myfirstdatabase;
Create a database table plus a semicolon, and add character formatting UTF8
MySQL>createtable table_name ( >varchar(20 ), >varchar(+), >int );
View tables plus s and semicolons in the database
MySQL>show Tables;
Database operations Select, INSERT, UPDATE, delete
SelectCode,name,age fromtable_name;Insert intoTABLE_NAME ('0001','Zhang Mowgli', at);Updatetable_nameSetName='Zhang Trixan' whereCode='0001';Delete fromtable_namewhereCode='0001';
The delete operation is still a little bit different from the ms-sql.
View table Design
MySQL>desc table_name;
Add a table field plus a semicolon;
MySQL>altertableaddvarchar;
Modify a field in a table
MySQL>altertablevarchar();
To delete a column in a table
MySQL>altertabledrop address;
A field in a table is set as the primary key
MySQL>altertableaddprimarykey (code);
A field in a table joins a normal index, unique index keyword unique, full-text index fulltext, multi-column index
MySQL>alter tableaddindex index_name (Codel);
MySQL>altertableaddindex index_name (code,name);
Simply review the MySQL command-line operation