练习SQL2008语句笔记

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 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。