当前位置:网站首页>Final examination questions of Database Principles
Final examination questions of Database Principles
2022-06-22 04:41:00 【University of science and technology Yunju】
score |
Four 、 Practical questions ( This topic consists of 1 Little topic , common 18 branch )
1、 Suppose that a factory producing parts has several workshops , Each workshop processes several kinds of parts , Each part is processed in a certain workshop ; The attribute of a workshop has a workshop name ( only )、 Telephone ; Part attributes have part numbers 、 Part name ; The parts are made of different raw materials , The raw materials used for different parts can be the same , It could be different ; The attribute of making has the making time ; The properties of materials include material number and supplier . Please draw the corresponding E-R chart , And write the corresponding relationship pattern .
(1)E-R chart ( Mark the contact type )(10 branch )

(2) The transformed relational schema ( It is required to achieve Third normal form , Primary key and Foreign keys You can use A symbol mark or After the relational mode, the text expresses )(8 branch )
Relationship model

5、 ... and 、SQL Practical questions ( This topic consists of 2 Little topic , The first 1 Little topic 27 branch , The first 2 Little topic 5 branch , common 32 branch )
1、 There is an existing one named “HouseSelling” The database of , There are three tables under this database , As required , Write the corresponding SQL sentence .( common 6 A little question , among 1-3 Each question 4 branch ,4-6 Each question 5 branch , common 27 branch )
(1) Listings (houses),“ House number ” Primary key .
(2) Salesman list (salesman),“ Salesman number ” Primary key .
(3) Sales list (sales),“ Salesman number , House number ” Primary key , Both the salesperson number and the house source number are foreign keys .
explain : In the following data sheets “()” Part is field type ,SQL When you write a statement Please write the field name correctly , If the field name is misspelled, points will be deducted .
houses surface
House number (char(12)) | Community name (char(20) | area (float) | The total price (decimal(10,2)) | floor (int) | General floor (int) | Completion date (date) | Number of rooms (int) |
100-5-202 | Tianhua garden | 55.90 | 1000000.00 | 2 | 15 | 2010.7.1 | 1 |
111-10-401 | Zhongcheng Pavilion | 85.73 | 1700000.00 | 4 | 5 | 2013.12.2 | 2 |
100-2-801 | Shiyuan City | 110.21 | 2298900.00 | 8 | 12 | 2015.9.1 | 3 |
233-1-302 | Philanthropic predestination | 79.27 | 1595000.00 | 3 | 6 | 2018.7.1 | 2 |
100-5-302 | Tianhua garden | 55.90 | 1050000.00 | 2 | 15 | 2010.7.1 | 1 |
111-10-501 | Zhongcheng Pavilion | 85.73 | 1760000.00 | 4 | 5 | 2013.12.2 | 2 |
100-2-1001 | Shiyuan City | 110.21 | 2198900.00 | 8 | 12 | 2015.9.1 | 3 |
233-1-602 | Philanthropic predestination | 79.27 | 1545000.00 | 3 | 6 | 2018.7.1 | 2 |
sales surface
Salesman number (char(7)) | House number (char(12)) | Sales date (date) |
10002 | 111-10-401 | 2014-5-3 |
12010 | 233-1-302 | 2018-10-2 |
12003 | 233-1-602 | 2018-9-10 |
10002 | 100-5-302 | 2011-1-2 |
salesman surface
Salesman number (char(7)) | full name (char(10) | Gender (char(2) | Telephone (char(11)) |
10002 | Sun Hua | male | 13502100210 |
12003 | Zhang Guihua | Woman | 13502100211 |
12010 | Liu Yuanhang | male | 13502100212 |
15079 | Wangxingxin | male | 13502100213 |
- Query all in 2015 Information on houses built in and after , Include listing number 、 Community name 、 area 、 The total price 、 Number of rooms .
Select House number , Community name , area , The total price , Number of rooms from houses Where year( Completion date )>=2015
- stay salesman Insert a record in the table , full name : still , male , The number is 20001, The mobile number is 15120136490.
Insert into salesman values (‘20001‘,‘ still ‘,‘ male ‘,‘15120136490‘)
- The number is “10002” The salesperson changed his mobile phone number for some reason , Please be there. salesman Change its mobile phone number to “18902016688”.
Update salesman set Telephone =‘18902016688‘ where Salesman number =‘10002‘
- Delete the salesperson information without sales performance .
Delete from salesman where Salesman number not in (Select distinct Salesman number from sales)
- Query the information about the houses sold by the female salesperson , Including name, 、 House number 、 community 、 Area and total price .
Select full name , House number , community , area , The total price from houses h,salesman sm,sales ss
Where h. House number =ss. House number and sm. Salesman number =ss. Salesman number and Gender =‘ Woman ‘
- Count the number of houses in each community , Display the name of the community and the number of houses .
Select Community name ,count(*) AS Number of houses available from houses group by Community name
2、 According to the corresponding requirements , Write the corresponding T-SQL sentence , Complete related functions .( common 2 Little topic , please Choose any question Answer , common 5 branch )
According to the previous question “HouseSelling” Complete the following two questions , Choose any question Can be completed .
- Establish a stored procedure to count the historical sales performance of salespeople p_sales_smno( The salesperson number is the input parameter ), Display the salesperson's name 、 House number 、 Sales date 、 Total price information , And call execution ( The query salesperson number is 10002 Historical sales performance ).
stored procedure :
Create proc p_sales_snmo @smno char(7) AS
Select full name , House number , Sales date , The total price from houses h,salesman sm, sales ss
Where h. House number =ss. House number and sm. Salesman number =ss. Salesman number
And Salesman number [email protected]
Calls to perform :
execute p_sales_smno ‘10002‘
- Set up triggers t_house_update, When updating the listing information , The total price should be within 100 Wan to 300 Between ten thousand , otherwise , Tips “ The price is out of range ”, And cancel the relevant operation .
Create trigger t_house_update on houses After Update AS
If not exists(select * from inserted where The total price between 1000000 and 3000000)
Begin
Rooback;
Print ‘ The total price is out of range ‘;
End
边栏推荐
- Solutions pour l'écran bleu idea
- Code example of map and entity class Interoperation
- Tianyang technology - Bank of Ningbo interview question [Hangzhou multi tester] [Hangzhou multi tester \wang Sir]
- FaceShifter.ipynb
- LeetCode 437. Path sum III - binary tree series question 13
- Network Interview eight part essay of daily knowledge points (TCP, startling group phenomenon, collaborative process)
- JUC - 线程中断与线程等待、唤醒(LockSupport)
- Why does golang not recommend this/self/me/that/_ this
- About SSM integration, this is enough ~ (nanny level hands-on tutorial)
- IDEA藍屏的解决方案
猜你喜欢

Write the first C application -- Hello, C

IDEA蓝屏的解决方案

Case driven: a detailed guide from getting started to mastering shell programming

Take you to develop an efficiency enhancing tool -- vscode plug-in

With this set of templates, it is easier to play with weekly, monthly and annual reports

Overrides vs overloads of methods

It is easy to analyze and improve R & D efficiency by understanding these five figures

软考2022年下半年考试科目安排

套用这套模板,玩转周报、月报、年报更省事

Ora-15063: ASM discovered an insufficient number of disks for diskgroup
随机推荐
Postman document parameterization
音频帧大小的计算
Popular science of source code encryption technology
【科研笔记】关于使用openslide切图的下采样倍数
套用这套模板,玩转周报、月报、年报更省事
【使用指南】使用公共的conda创建环境
Odoo Development Manual (I) the second day of contact with odoo
通过ip如何免费反查域名?
Wisdom, agriculture, rural areas and farmers digital Wang Ning: Tips for beginners on the first five days of trading
After the active RM machine is powered off, RM ha switching is normal. However, the cluster resources cannot be viewed on the yarnui, and the application is always in the accepted state.
源代码加密技术科普
Graph calculation on nlive:nepal's graph calculation practice
天阳科技-宁波银行面试题【杭州多测师】【杭州多测师_王sir】
Tencent一面
Systematic arrangement | how many children's shoes have forgotten to be done carefully before the model development (practical operation)
slurm 使用教程
使用Chrome调试微信内置浏览器
Use echart to draw 3D pie chart, dashboard and battery diagram
Browser -- a collection of common search operators -- use / instance
【故障诊断】CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace b