//Create a database (the end of MySQL statement in PHP is not added, because the MySQL tone in PHP can only execute one sentence at a time)Create Databasetestdatabase;//Select Database Usetestdatabase;//Create a data tableCreate TableTest_table (first_namevarchar( -), last_namevarchar( -));//inserting data into a data tableInsert intoTest_table (First_name,last_name)Values('Sally','Jones');
That's not good.
insert into test_table values(' Sally ',' Jones ');//Querying DataSelect * fromtest_table;SelectFirst_Name fromtest_table;SelectFirst_Name fromTest_tablewhereFirst_Name='Sally';//emptying data table dataDelete fromtest_table;//Delete data table row dataDelete fromTest_tablewhereFirst_Name='Sally' orLast_Name='Jones';//Delete a data tableDrop Tabletest_table;//Deleting a databaseDrop Databasetestdatabase;//add a column to the data tableAlter TableTest_tableAddIdint;//add a column to the data table and set the primary key (not empty, self-increment, at the front of the table)Alter TableTest_tableAddIdint not NULL auto_increment First,Add Primary Key(ID);//to delete a column in a data tableAlter TableTest_tableDrop columnfirst_name;//Modify column names and data types for a column in a data tableAlter TableTest_table Change columnFirst_Name Middle_nameChar;//Modify the column name of the data table column, locationAlter TableTest_tableModify columnfirst_name middle_name;Alter TableTest_tableModify columnfirst_name first;Alter TableTest_tableModify columnLast_Name AfterMiddle_name;
MySQL Operation statement