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

练习SQL2008语句笔记

时间:2015-05-20 18:28:02      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:sql

CREATE TABLE T_Person3(Id int NOT NULL,Name nvarchar(50),Age int NULL) 
DROP TABLE T_Person3
INSERT INTO Person_1(Number,Name,Age) VALUES(4,'xxxxxxx',20)
SELECT newid()


UPDATE Person_1 set Age=30
UPDATE Person_1 set Name='liming' where Age>=30

select * from Person_1
select Name from Person_1
select * from Person_1 where Age>20


select GETDATE()
select @@version
select 100-20 as sub

select COUNT(*) from Person_1
select MAX(Number) from Person_1
select AVG(Number) from Person_1

select * from Person_1 order by Age 
select * from Person_1 order by Age ,Name DESC

select * from Person_1 where Name LIKE '_ieniyimiao'
select * from Person_1 where Name LIKE '%i%'

select null+1

select * from Person_1 where Name is not null
select * from Person_1 where Age in(20,18,30)
select * from Person_1 where Age between 1 and 22


select Age,count(*) from Person_1  group by Age

select top 3 *from Person_1 order by Age DESC 

练习SQL2008语句笔记

标签:sql

原文地址:http://blog.csdn.net/u013467442/article/details/45873419

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