![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据库
文章平均质量分 80
niujunluck
这个作者很懒,什么都没留下…
展开
-
有学生科目成绩表这三张表要求查处各个科目的前三名成绩
create table student( sid int identity(1,1) primary key, sname varchar(20) not null)create table coures( cid int identity(1,1) primary key, cname varchar(20))create table score( scid int identity(...2011-08-24 08:02:25 · 942 阅读 · 0 评论 -
如何把sqlserver中的列转换成行,行转换成列,显示。
上次做活的时候碰到客户提的一个需求,就是要把数据库中得列转化为行来显示。呵呵,自己网上也找了一些解决方案,加上自己的一个解决方案,做一个总结,以免下次再碰到这种情况,也算是一种经验的积累把。 create database arrongouse arrongo-- createTable init Datacreate table stu...原创 2011-11-16 18:21:54 · 740 阅读 · 0 评论 -
一个sql游标使用例子
前几天要处理一批数据,发现使用表连接,或者子查询都很难解决客户的需求,所以后来只能使用sql游标,加sql程序块来处理。 我想自己以后用得着。begin try begin transaction; declare @currentTime datetime; select @currentTime = sysd...原创 2013-03-05 15:59:11 · 117 阅读 · 0 评论 -
有用的sql语句
--sql 1 将一张表的字段通过另一张表之间的对应关系进行更新。update WarrantySaleItem set applicableName = a.applicableNamefrom Applicable a where a.ID = WarrantySaleItem.applicableName --sql 2 通过一张表更新另一张表的数据。属于实用性的sql...原创 2012-03-14 15:04:19 · 115 阅读 · 0 评论