SQL Server 基础语句学习(二)

1. Update   

Update table_name Set column_name = value_new Where ...

Tips: 更新多个值,用逗号分隔

2. Delete

Delete From table_name where ...

Tips: 删除全部数据

Delete From table_name

3. Top

Select top 3 * from table_name

Select top 30 percent * from table_name

 4.通配符

'%'   -  一个或多个字符

'_'    -  一个字符

'[abc]'  -  abc 中任意单字符

'[^abc]' - 不在abc 中的任意单字符

Tips:

查询目标为null 时 用 IS Null

Select * from table_name where column_name is Null

查询目标为空值是用 ''

Select * from table_name where column_name like ''

 5. In - 多个值,
     Between…And   - 之间的数值,文本或日期 

Select * from table_name where column_name in (value1, value2)

Select * from table_name where column_name between value1 and value2 order by column

Select * from table_name where column_name not between value1 and value2

 6. Alias

Tips: 表的alias

Select column_name From table_name as alias_name

列的alias

Select column_name as alias_name from table_name

 

posted on 2013-07-11 18:16  百花宫  阅读(244)  评论(0编辑  收藏  举报