- 1、本文档共3页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
sql中as的用法和一些经典的sql语句
2008-08-21 21:55
总结一些工作中用到或碰到的SQL语句,希望能与大家分享,同时也希望大家能提供更多的精妙SQL语句.....1、delete table1 from (select * from table2) as t2 where table1.id=t2.id2、truncate table table1 (不在事务日志中做记录,比delete table快,但不能激活触发器)3、update table1 set column=column+1 where id=(select id from table2)4、update table1 set column=column+1 from table1,table2 where table1.id=table2.id5、select top n [Percent] * from table1 输出百分比记录6、select id,column1 * column2 as column from table1 可算明白as的用法了7、select * from table1 where column1 like SQL#_G_O escape # 单匹配8、select table1.id from table1 where not exists (select table2.id from table2 where table1.id=table2.id) 这个应该比not in快一些9、select table1.id from table1,table2 where table1.idtable2.id 看复合查询机制10、select table1.id from table1,table2,(select id from table3) as t3 where table1.id=table2.id and table2.id=t3.id 有些类似[1]了......11、select * from table1 where column1 like [A]% or like [^B]%12、select @column1=column1 from table1;select @column1 as column1 存储到自定义变量13、select * from table1 where contains(column1,char1 or char2*) 全文索引14、select * from table1 where contains(column1,前有 near 中有 near 后有)15、select * from table1 where contains(column1,formsof(inflectional,go)) 派生16、select * from table1 where contains(description,isabout(apple weight(.9),boy weight(.8),china weight(.7))) 权重17、select * from table1 where freetext(column1,char) 仅支持文字不支持表达式搜索18、insert into table1 select column1,count(column1) from table2 group by column1 统计-----------------------------------------------------------------------------------------1 说明:复制表(只复制结构,源表名:a 新表名:b)SQL: select * into b from a where 11
2 说明:拷贝表(拷贝数据,源表名:a 目标表名:b)SQL: insert into b(a, b, c) select d,e,f from b;
3 说明:显示文章、提交人和最后回复时间SQL: select a.title,a.username,b.adddate from table a,(select max(adddate) adddate from table where table.title=a.title) b
4 说明:外连接查询(表名1:a 表名2:b)SQL: select a.a, a.b, a.c, b.c, b.d, b.f from a LEFT OUT JOIN b ON a.a = b.c
5 说明:日程安排提前五分钟提醒SQL:??? select * f
您可能关注的文档
最近下载
- 小学科学人教鄂教版六年级下册第一单元《生物与环境》教案(2023春.pdf VIP
- 人教鄂教版科学六年级下册第一单元生物与环境单元教案.pdf VIP
- 一例高血压患者的护理个案.docx VIP
- 青岛版六年级下册科学《生物与环境》大单元教学方案与反思.docx VIP
- 甘肃《建筑抗震加固工程消耗量定额》.pdf
- 高中英语1.5万考点.pptx VIP
- 新人教鄂教版六年级下册科学第一单元《生物与环境》全单元课件.pptx VIP
- CFMOTO春风动力450SR S CF400-9(6AQV-380101-3000-11 CN233)摩托车使用手册.pdf
- 水电站砂石系统施工组织设计(221页).docx VIP
- 2024新人教版初中英语七年级下册重点知识点归纳(复习必背).pdf VIP
文档评论(0)