数据库小技巧
dongqinglove
下里巴人
展开
-
数据库小技巧
select * from sysobjects where name='V_ZYK_HistoryPinJia' 查询数据库中V_ZYK_HistoryPinJia对象 Select Name FROM Master..SysDatabases orDER BY Name 查询所有的数据库原创 2013-08-08 11:47:29 · 553 阅读 · 0 评论 -
分页 数据库实现
SQL 2000 查看第4页的内容 select top 5 * from customers where customerId not in ( --3*5=15 select top 15 customerId from customers order by customerid asc ) order by customerid SQL 2005 Row_Number函数简原创 2013-08-07 21:29:38 · 774 阅读 · 0 评论 -
数据库子查询
子查询就像使用普通的表一样,被当作结果集的查询语句被称为子查询。所有可以使用表的地方几乎都可以使用子查询来代替。 SELECT * FROM (SELECT * FROM student where sAge 只有返回且仅返回一行、一列数据的子查询才能当成单值子查询。 子查询返回的值不止一个。当子查询跟随在=、!=、、、>、>= 之后,或子查询用作表达式时,这种情况是不允许的。原创 2013-08-07 20:50:00 · 708 阅读 · 0 评论 -
一次插入多条数据
方法一: insert into Score(studentId,english,math) select 1,80,100 union select 1,80,100 union select 3,50,59 union all select 4,66,89 union select 5,59,100 此处如果用union all同样会去除重复数据。 方法二: 把现有表的数原创 2013-07-24 22:36:00 · 790 阅读 · 0 评论