Library operation: show databases;//Show All DatabasesDrop database dbName;//Deleting a databaseCreate DATABASE [ifNot EXISTS] dbName;//Create a databaseUse DbName;//Working with DatabasesShow tables;//displays the name of the table that is currently using the databaseDesc TableName;//show the specific table structuretable operation: Drop table tableName;//Delete a table-create Table TableName (uIdint, Upricedecimal);//Create a data table with UID and Uprice fields-create Table Newtablename (uIdint) as SelectUid fromUser//Copy the UID column from the data table user into the new data table and create the new table-create Table Newtablename as Select* fromuser; single column: ALTER TABLE TABLENAME ADD Tel varchar ( One)default '14545';//add a field inside a table-Multiple columns: ALTER TABLE tableName Add (photo blob,birthday data);//Add multiple ColumnsALTER TABLE Oldusername Rename to Newusername;//Rename table nameALTER TABLE tableName change oldname newName varchar (Ten);//Field RenameALTER TABLE TABLENAME Modify TEL varchar ( the)default‘48777777889979' first; Modify the Tel field and let him show the ALTER TABLE TableName drop tel in column one;//Delete Tel field
MySQL basic operation (i)