求SQL初级语法题,急!

来源:百度知道 编辑:UC知道 时间:2024/06/15 23:53:14
就是简单的测试题,初级的,SQLSERVER
给链接也行。最好有答案的!谢谢了!

http://hi.baidu.com/mkjxknioitvere/blog/item/f7937003976113064afb5159.html
比较初级的sql

sql 中Table中一个 int 列,内容是 1、2、4、5、6、9、……138、200 共100行纪录,但是最后一行的值是 200,也就是说肯定是不连续的,用一个sql语句找到第一个断位的数的值, 如上面的序列就是 3
select top 1 t1.Value+1 from Table1 t1
where not exists ( select 1 from Table1 t2 where t2.Value = t1.Value +1 )
order by t1.Value

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

select top 10 * from A where id not in (select top 30 id from A order by id) order by id