當前位置:首頁 » 編程語言 » 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))

熱點內容
mac上傳ftp 發布:2025-02-04 15:49:36 瀏覽:266
安卓手機的充電器線不好使了怎麼辦 發布:2025-02-04 15:44:28 瀏覽:633
騰訊安卓手游下載平台叫什麼名字 發布:2025-02-04 15:43:48 瀏覽:6
squid源碼 發布:2025-02-04 15:38:07 瀏覽:793
30秒創意廣告腳本 發布:2025-02-04 15:36:35 瀏覽:3
暴風影音怎麼不能緩存 發布:2025-02-04 15:34:24 瀏覽:904
超級訪問劉亦菲 發布:2025-02-04 15:30:22 瀏覽:318
C語言加加b 發布:2025-02-04 15:29:44 瀏覽:278
存儲系統的發展 發布:2025-02-04 15:10:29 瀏覽:585
linux太多 發布:2025-02-04 15:07:31 瀏覽:819