Home > Backend Development > PHP Tutorial > Several mysql statements commonly used in PHP_PHP tutorial

Several mysql statements commonly used in PHP_PHP tutorial

WBOY
Release: 2016-07-13 17:30:05
Original
1123 people have browsed it

Several mysql statements commonly used in PHP
Show database or table:
show databases;//Then you can use database_name;
show tables;
Change table name:
alter table table_name rename new_t;
Add columns:
alter table table_name add column c_n column attributes;
Delete column:
alter table table_name drop column c_n;
Create index:
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);
Delete index:
alter table c_table drop index c_n1;
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;
Delete database or table:
drop table table_name;
drop database database_name;//Use mysql_drop_db() Can be deleted.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/509207.htmlTechArticleSeveral mysql statements commonly used in PHP display databases or tables: showdatabases;//Then you can usedatabase_name; showtables; change Table name: altertabletable_namerenamenew_t; Add column: altert...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template