码迷,mamicode.com
首页 > 数据库 > 详细

sql基本

时间:2017-09-27 20:44:10      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:多个   update   select   ^c   sel   索引   删除   from   har   

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基本

标签:多个   update   select   ^c   sel   索引   删除   from   har   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!