首页 > 数据库技术 > 详细

sql基本

时间:2017-09-27 19:46:01      阅读:253      评论:0      收藏:0      [点我收藏+]

SELECT:

  select * from table

  select 列名 from table

  select DISTINCT 列名 from table

INSERT:

  insert into table values(‘‘,‘‘,‘‘,‘‘...)

  insert into table(列,列..) values(‘‘,‘‘,..)

UPDATE:

  update table set 列=新值 where 列=某值

DELETE:

  delete from table where 列=某值

  delete * from table   (删除数据,不破坏表结构,属性,索引)

TOP:

  select top 2 * from table

  select * from table limit 2

  select top 50 percent * from table (选取50%的记录)

LIKE:

  select * from table where 列 NOT LIKE ‘%lon%‘;

通配符:

  %:替代一个或多个字符

  _:一个字符

    [ char list]:字符列中任一单个字符

  [^char list] 或者[!charlist] :不在字符列中的任一单个字符

  select * from table where column like ‘[ALN]%‘;   //以A / L / N开头的

IN:

  select * from table where column IN (value1,value2,...)

Alias(别名):

  select p.Firstname from persons AS p where p.Lastname=‘John‘

 

sql基本

原文:http://www.cnblogs.com/Uhey/p/7603457.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!