【SQL开源代码栏目提醒】:网学会员鉴于大家对SQL开源代码十分关注,论文会员在此为大家搜集整理了“227.sql”一文,供大家参考学习
use db_Sql
GO
if exists(select * from INFORMATION_SCHEMA.TABLES
where table_name = ' tb_info')
drop table tb_info
GO
create table tb_info
(
id int,
number int
)
GO
insert into tb_info
values(1,1)
insert into tb_info
values(2,2)
insert into tb_info
values(3,3)
insert into tb_info
values(4,4)
go
with x (id,num,i)
as
(
select id ,number,row_number() over (order by id) from tb_info
)
select id,num from x where i %2 =0