????4.?ж??????????????
????select count(*) from product
????select top(1) id from product
????????????????
????5.???????????
???????????ū???????????????????????????????????????????????????????????
?????????????????С???
????????????????С????????????????????????
???????????????????С????????
?????????????????????????????????????????????
????select * from
????( (select * from orde where OrderId>10000) o  left join orderproduct op on o.orderNum=op.orderNum )
????select * from
????( orde o left join orderproduct op on o.orderNum=op.orderNum )
????where o.OrderId>10000

??????????????????????????????????Ч???
????insert???????
????--?????????

create table #tb1
(
id int??
name nvarchar(30)??
createTime datetime
)
declare @i int
declare @sql varchar(1000)
set @i=0
while (@i<100000)  --???????10w??????
begin
set @i=@i+1
set @sql=' insert into #tb1 values('+convert(varchar(10)??@i)+'??''erzi'+convert(nvarchar(30)??@i)+'''??'''+convert(nvarchar(30)??getdate())+''')'
exec(@sql)
end
???????????????????51??
????--?????????
create table #tb2
(
id int??
name nvarchar(30)??
createTime datetime
)
declare @i int
declare @sql varchar(8000)
declare @j int
set @i=0
while (@i<10000)  --???????10w??????
begin
set @j=0
set @sql=' insert into #tb2 select '+convert(varchar(10)??@i*100+@j)+'??''erzi'+convert(nvarchar(30)??@i*100+@j)+'''??'''+convert(varchar(50)??getdate())+''''
set @i=@i+1
while(@j<10)
begin
set @sql=@sql+' union all select '+convert(varchar(10)??@i*100+@j)+'??''erzi'+convert(nvarchar(30)??@i*100+@j)+'''??'''+convert(varchar(50)??getdate())+''''
set @j=@j+1
end
exec(@sql)
end
drop table #tb2
select count(1) from #tb2
?????????????????????20??
?????????????insert into select????????????????Ч????????????????????????????
????????????????
????????????????????????????????cpu????????????????????????????
???????????????????????????????????????????????Ч?????????????????????????
???????????????????
???????е??????????????????
????delete product where id<1000
????delete product where id>=1000 and id<2000
????delete product where id>=2000 and id<3000
????.....
????????????????????????????????????????????????????????????????????????????????????????????????????????Ч????
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????