MySQL statements are often used in PHP Development. the following lists some frequently used MySQL statements, hoping to play a role in your daily learning and development work. MySQL statement display database or table: showdatabases; // then you can usedataba... "> <LINKhref =" http://www.php100.com/
MySQL statements are often used in PHP Development. the following lists some frequently used MySQL statements, hoping to play a role in your daily learning and development work.
MySQL statements display databases or tables:
Show databases; // You can then use database_name;
Show tables;
MySQL statement to change the table name:
Alter table table_name rename new_t;
Add a column in a MySQL statement:
Alter table table_name add column c_n column attributes;
MySQL statement:
Alter table table_name drop column c_n;
Create an index using a MySQL statement:
Alter table c_table add index (c_n1, c_n2 );
Alter table c_table add unique index_name (c_n );
Alter table c_table add primary key (sid );
MySQL statement to delete an index:
Alter table c_table drop index c_n1;
MySQL statement to change column information:
Alter table t_table change c_1 c_1 varchar (200 );
Alter table t_table modify 1 c_1 varchar (200 );
Insert statement:
Insert into table_name (c_1, c_2)
Values ('X1', 1 );
Update statement:
Update table_name set c_1 = 1 where c_2 = 3;
MySQL statement to delete a database or table:
Drop table table_name;
Drop database database_name; // data that can be deleted using mysql_drop_db.