数据库编程复习(修改版)

上传人:wm****3 文档编号:42862160 上传时间:2018-06-04 格式:DOC 页数:5 大小:44KB
返回 下载 相关 举报
数据库编程复习(修改版)_第1页
第1页 / 共5页
数据库编程复习(修改版)_第2页
第2页 / 共5页
数据库编程复习(修改版)_第3页
第3页 / 共5页
数据库编程复习(修改版)_第4页
第4页 / 共5页
数据库编程复习(修改版)_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《数据库编程复习(修改版)》由会员分享,可在线阅读,更多相关《数据库编程复习(修改版)(5页珍藏版)》请在金锄头文库上搜索。

1、3G 一班学生开张重走长征路活动,目的地北京,其中 1 到 40 号为男生,41 到 65 号为女 生,男生从广州出发,行程 2100 公里,女生从长沙出发,行程 1100 公里,之后从北京集 体回到广州,计算全部学生的总行程。 Create database calss3g1 On primary ( name=calss3g1_dat, Filename=d:class3g1.mdf, Size=1mb, Maxsize=2mb, Filegrowth=100% ) Log on (name=class3g1_log, Filename=d:class3g1.ldf, Size=1mb,

2、Maxsize=2mb ) Create table c3g1 ( SID int, Gender char(2) defaule , Go_km int ) Insert into c3g1 Values(1,男,2100)Insert into c3g1 Values(40,男,2100)Insert into c3g1 Values(41,女,1100) Insert into c3g1 Values(65,女,1100)Select sum(go_km)+2100*65 from c3g12,将 ax2 +bx+c=y 作为自变量,与因变量的关系 x 从 0.1 到 0.99,将 x,

3、y,a,b,c 记录在表格 A 中 Create table A ( a int, b int, c int,x float(4), y float(4) )Create procedure p_mn a int =1,b int=2,c int =3,x float(4) sum: while(x0 set c=a/b print c go exec p1 a=2,op=/,b=1 解法 2 create procedure p_a a float,b float,op char(2) as declare c float set c=case op when op=+then a+b wh

4、en op=-then a-b when op=*then a*b when op=/then a/b end go 5 由 1 加到 100,并且不计偶数。 create procedure p_sum as declare i int set i=1 ag: if(i%2=1)and(i1set c=不成立endelse set c=请输入正确的数据范围 goreturn cendselect dbo.p(6.4)go9 某线路由 A,B,C,D,E,F,G 各站点组成,A 是起点,G 是终点,求中途站相邻路程。 create procedure p_nm as select identi

5、ty(int,1,1) as x , S,T into t2 from t1 where SA Declare loop int set loop=1 while loop=(select count(x) from t2) Begin select S,T into RT1 from t1 where T=(select T from t2 where x=loop) select S,T into RT2 from t1 where S=(select T from t2 where x=loop) select a.S,a.T,b.S,b.T from RT1 a,RT2 b select loop=loop+1 end goEXEC p_nm

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号