SQL语句:CRUD

Insert语句:Insert Into Shop_Customer(FirstName,LastName) Values('','');

 

Update语句:Update Shop_Customer Set FirstName='',LastName='' Where Id=@id

 

Delete语句:Select * From Shop_Customer Where Id=@id

 

Select语句:Delete From Shop_Customer Where Id=@id

 

2、写出一条Sql语句:取出表A中第31到第40记录(SQLServer,以自动增长的ID作为主键,注意:ID可能不是连续的。

方法一:Select * From (Select *,ROW_NUMBER() OVER(Order By Id ASC) As rn From Shop_Order) As TempTable
    Where rn > 3 And rn < 6
方法二:Select Top 2 * From Shop_Order Where Id Not In (Select Top 3 Id From Shop_Order)//前者是要取的条数,后者是排除的条数。

 

posted @ 2013-07-30 09:31  刘文天  阅读(313)  评论(0编辑  收藏  举报