SQL杂记

select distinct Company,Ordername from Orders where city = "Beijing" or address = "Sanltun" order by city,address DESC

update Person set Address = "Zhongshan 23",city = "Nanjing" where Lastname = "vilan"

insert into Person(Lastname,Address) values('Wilson',‘Champs')

Delete * from Person where Lastname = "Vilon"

常见词

TOP前,like(_, [], %)通配符,in类似or,between...and...,as别名

union合并,select into备份,index索引,drop != truncate删,

alter table... add/drop column...增/删列,

约束

not null,unique, primary key, foreign key, check, default,

select funtion() from Table

group by...having...

其他

逗号,= join。left join右可空,right join左可空,

where != on,用join语句要用on

单个view可改,复合view不可改。 

猜你喜欢

转载自blog.csdn.net/zhenyu233/article/details/81075212