当前位置:首页 » 编程语言 » sql编程试题

sql编程试题

发布时间: 2022-06-30 03:32:14

A. 数据库sql编程

declare @j int,@o int,@i int
set @i=1
set @j=0
set @o=0
while @i<=40
begin
if(@i%2=1)
set @j=@j+@i*@i
else
set @o=@o+@i*@i
set @i=@i+1
end
print 'x='+convert(char(5),@j)+',y='+convert(char(5),@o)

B. SQL计算机语言编程题求解

1.
selectproctid,proctname,companyname,.SupplierID=categories.SupplierID,joinsuppliersonprocts.SupplierID=suppliers.SupplierIDwhereCategoryName='seafood';
2.
selectcategoryname,avg(unitprice).categoryId=categoris.categoryIdgroupbyprocts.categoryId;
3.
selectorderid,companyname,lastname,firstname,.CustomerID=customers.CustomerID,joinemployeesonorders.employeeid=employees.employeeidorderbyorderdate;
4.题目不全

C. 求做一道SQL编程题

1(5分)、对于给出的yggl数据库表结构,自定义一个数据类型id_type,用于描述员工编号。
2(5分)、通过用创建规则对象然后再绑定到列上的方式,对salary表中outcome实现check约束,约束outcome的范围在0到500元之间。
3(5分)、通过用sql语句创建默认值对象然后再绑定到列上的方式,对salary表中income实现默认值约束,默认值为2000元。
4(5分)、将工资表的信息按照如下规则转换后输入。收入超过2500改为“高收入”,收入介于2000和2500之间改为“中等收入”,收入低于2000改为“低收入”。(请截取查询结果)
5(10分)、编写代码。实现1+2+3+4+……+100的T-sql程序。
6(10分)、编写函数:根据员工编号求出每位员工的年收入,并调用该函数求出‘000001’员工的年收入。
7(10分)、 创建触发器t3,当删除departments 表中一条记录的同时删除该记录departmentid字段值在employees表中对应的记录。
Employees:员工信息表

D. SQL编程题(比较急用,请解下)

1.select
count(title_id) as
订货总量 from
sales
where
stor_id
=
7131
2.select
*
from
titles
where
title
like"%
' %"
3.select
max(price)
from
titles
4.select type
from
titles
where
title_id
=
(select
title_id
from
sales
where min(qty) )
5.select type
from
titles
where
title_id
=
(select
title_id
from
sales
where
max(qty))
先说下个人看法啊,注意。不是标准答案!
个人认为呢,所谓销量最好的,应该是库存中数量比较少的(卖得多自然就存不了很多)。
所谓销量最差的,应应该是库存中最多的(卖不出去,越积越多)。

E. 关于数据库SQL语言编程的一道题目,求解答!

查询学生人数:select count(*) from 学生s
5门以上学生学号:select sno from (select sno,count(cno) cnum group by 学生选课sc) where cnum>5
删除:
delete from 学生课程sc where cno=(select cno from 课程c where 课程姓名cn=‘数据结构');
delete from 课程c where 课程姓名cn='数据结构';

F. sql编程题

1,select * from 课程表 where 课程号 not in(select 课程号 from 选课表)
2,select case when length(trim(sfzid))=15 case when substr(trim(sfzid),15,1)%2=0 then '女'else '男' end else case substr(trim(sfzid),18,1)%2=0 then '女',else '男') end end from 表;
3,select * from 表 where name in (select name from (select name,cout(*) from 表 group by name having count(*)>1));

G. SQL语言编程题

  1. SELECT * FROM Patients where WID in ('1','3','5')

  2. select D.DName,P.PName from Doctors as D left join Patients as P on D.DID = P.DID

  3. 创建一个修什么的特定编号,看不清,我按照给一个编号和要修改的学历信息而创建的存储过程(写的不是很专业见谅)

H. SQL编程题的答案是什么

1.
CREATE TABLE `student` (
`Sno` int(5) NOT NULL,
`Sname` varchar(6) NOT NULL,
`Ssex` varchar(2) NOT NULL,
`Sdept` char(255),
`Sage` int(2) CHECK (value BETWEEN 15 AND 25),
PRIMARY KEY (`Sno`)
)
2.select * from student where Sname like '张%';
3.没有SC表结构
4.insert into student values(95020,"陈冬","男","CS",18)
5.猜的表结构,update set 学分=3 where cno='3';

I. PL/SQL编程题

1,select ENAME as 姓名 MGR as 介绍人 from 员工表
2,update 员工表 set 身份证号码=SUBSTRING(身份证号码,1,6)+'19'+SUBSTRING(身份证号码,7,6)+cast(rand()*999 as int) +(性别+1)
注释:性别为bit类型,0表示女,1表示男)
3,update 员工表 set 工资字段=工资字段+10 where GETDATE()- 工龄 >'1901-01-01 00:00:00'

J. SQL 编程题

1.
create table Student
(
id int not null identity(1,1),
Sno nvarchar(50) not null unique,
Sname nvarchar(20),
Ssex nvarchar(2),
Sage int,
Sdept nvarchar(100),
)

2.select * from Student where Sdept='计算机' order by Sno desc

3.select Sno,Sname,Ssex from Student where Sno in (select Sno from Course where Ccredit = 5 and Cno in (select Cno from SC where Grade > 60))

热点内容
jsp访问不到数据库数据库数据库 发布:2025-02-04 16:41:24 浏览:282
欧迪a4哪个配置最值得买 发布:2025-02-04 16:39:08 浏览:303
编译包含调试信息的oat文件 发布:2025-02-04 16:39:07 浏览:152
一梦江湖官服怎么在安卓下载 发布:2025-02-04 16:38:17 浏览:857
电脑华为云空间哪里密码设置 发布:2025-02-04 16:22:15 浏览:756
sql不重复记录 发布:2025-02-04 16:21:39 浏览:510
硬盘缓存速度 发布:2025-02-04 16:20:51 浏览:586
cmc的密码是什么意思 发布:2025-02-04 16:16:01 浏览:970
ccs编译找不到汇编程序 发布:2025-02-04 16:15:52 浏览:772
安卓如何恢复删除记录 发布:2025-02-04 16:12:08 浏览:609