create data data _name;
$conn = mysql_connect(“localhost”,”username”,”password”) or die ( “could not connect to localhost”); mysql_create_db(“data _name”) or die (“could not create data ”); $string = “create data data _name”; mysql_query( $string) or die (mysql_error());
use data _name
php: mysql_select_db()
$conn = mysql_connect(“localhost”,”username”,”password”) or die ( “could not connect to localhost”); mysql_select_db(“test”,$conn) or die (“could not select data ”);
create table table_name
create table table_name ( column_1 column_type column attributes, column_2 column_type column attributes, column_3 column_type column attributes, primary key (column_name), index index_name(column_name) )
$conn = mysql_connect(“localhost”,”username”,”password”) or die ( “could not connect to localhost”); mysql_select_db(“test”,$conn) or die (“could not select data ”); $query = “create table my_table (col_1 int not null primary key, col_2 text )”; mysql_query($query) or die (mysql_error());
index index_name(indexed_column)
create table table_name type=table_type (col_name column attribute);
alter table table_name
alter table table_name rename new_table_name
rename table_name to new_table_name
alter table table_name add column column_name colomn attributes
alter table my_table add column my_column text not null
alter table my_table add column my_next_col text not null first alter table my_table add column my_next_col text not null after my_other _column
alter table table_name drop column column name
alter table table_name add index index_name (column_name1,column_name2,……) alter table table_name add unique index_name (column_name) alter table table_name add primary key(my_column) alter table table_name drop index index_name
alter table_name test10 drop primary key
alter table table_name change original_column_name new_column_name int not null
alter table table_name modify col_1 clo_1 varchar(200)
insert into table_name (column_1,column_2,column_3,…..) values (value1,value2,value3,……)
insert into table_name (text_col,int_col) value (\'hello world\',1)
updata table_name set col__1=vaule_1,col_1=vaule_1 where col=vaule
drop table table_name drop data data _name
show columns from table_name show fields from table_name
select column_1,column_2,column_3 from table_name
select * from table_name
select * from table_name where user_id = 2
select * from users where city = ‘San Francisco'
select * from users where userid=1 or city='San Francisco' select 8 from users where state='CA' and city='San Francisco'
select * from users where zip!='1111′ or zip='1111′ or zip is null
select * from table_name where zip is not null
select distinct city,state from users where state='CA'
select * from users where lastchanged between 20000614000000 and 20000614235959 select * from users where lname between ‘a' and ‘m'
select * from users where state='RI' or state='NH' or state='VT' or state='MA' or state='ME'
select * from users where state in (‘RI','NH','VY','MA','ME')
select * from user where state not in (‘RI','NH','VT','MA','ME')
select * from users where fname like ‘Dan%' %匹配零个字符 select * from users where fname like ‘J___' 匹配以J开头的任意三字母词
select * from users order by lname,fname
select * from users order by lname asc, fname desc
select * from users limit 0,5 select * from users order by lname,fname limit 0,5
select * from users limit 5,5
select state,count(*) from users group by state
select count(*) from users
select * from companies,contacts where companies.company_ID=contacts.company_ID
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有