1. Create database create database lush;2. Delete Database drop database lush;3. Select the database use lush;4. Create user Grant all on *.* to ' lush ' @ '% ' identified by ' 123456 '; 5. CREATE TABLE create Table zhu (Id int,name varchar (20)); Delete table drop table zhu;6. View table Structure desc zhu;7. Insert Data insert into zhu values (1, ' Zhang3 '), (2, ' li4 '); 8. View Data select * from zhu;9. Modify Table Alter table zhu modify name varchar (Alter table zhu change); name name varchar (88); 10. Add Column Alter table zhu add column age int (2 ); 11. Delete Column alter table zhu drop id;12. Name the rename Alter table zhu change name myname varchar (two); #change和modify都可以修改表的定义, it is inconvenient to write the name of the column after the change, but the advantage of changes can modify the names of the columns, modify is not. 13. While adding a column, specify where the column is located in the table Alter table zhu add id int (5) first;alter table Zhu add id1 int (5) after myname;14. Renaming the table alter table zhu rename zhuzhu;
This article from "Wave Scouring sand" blog, declined reprint!
MySQL table defines the operation