当前位置:网站首页>Database interim (II)
Database interim (II)
2022-07-27 01:18:00 【lzl_ 0408】
Student ( Student number , full name , major ); Course ( Course no. , Course name , credits ); Course selection ( Student number , Course no. , achievement ); |
2) Write out the command of creating course information ;
Create table Course ( Course no. char(6), Course name varchar(30), credits decimal(2,1), Primary key ( Course no. ) ); create table stu( sno char(12), name varchar(120) not null, major varchar(30) not null, Primary key (sno) ); Coment on table stu is ‘ Student information sheet ’; Coment on column stu.sno is ‘ Student number ’; ALTER TABLE stu COMMENT=' Student information sheet '; ALTER TABLE stu MODIFY sno CHAR(6) COMMENT ' Student number '; Create table course( cno char(7), cname varchar(30) not null, credit decimal(2,1) not null, Primary key (cno) ); Create table sc( sno char(12), cno char(7), score decimal(4,1), Primary key (sno,cno) ); |
3) Write the relational algebraic expression of the following query :
a) The result is less than 60 The student number of the student ;
| Select sno From sc Where score < 60; |
b) The result is less than 60 The student number of the student 、 full name ;
Select stu.sno, name From stu, sc Where stu.sno = sc.sno And score < 60; |
c) Find out the student ID of students who have never taken elective courses ;
Select sno From stu Where sno not in (Select sno From sc); |
d) Find out the student number of the student with the lowest score ;
Select sno From sc Where score = (select min(score) from sc); |
e) At least 2 The number of courses selected by students ;
Select distinct sc.cno From sc, sc s1 Where sc.cno = s1.cno and sc.sno <> s1.sno; |
Select distinct sno From sc a Where not exists ( select * From course b Where not exists ( select * from sc where sno = a.sno and cno = b.cno)); |
g) Please at least choose C001 and C003 Students of two courses learn Number
select distinct sno from sc A where not exists( select * from course B where cno in ('C002','C003') and not exists( select * from sc C where A.sno=C.sno and B.cno=C.cno)); |
边栏推荐
- How can Tencent cloud live plug-in mlvb make use of these advantages to become the divine assistant of anchor Live Streaming?
- 玩客云搭配zerotier保姆级教学,保证学废
- 5. Xshell connection server denied access, password error
- Jenkins--基础--02--安装
- Choose RTMP or RTC protocol for mobile live broadcast
- onSaveInstanceState和onRestoreInstanceState方法的调用
- pytorch张量数据基础操作
- 05 - attack and defense of phishing websites
- 数据库期中(二)
- Spark accumulator
猜你喜欢

腾讯升级视频号小程序直播功能,腾讯持续推广直播的底气是这项叫视立方(MLVB)的技术

玩客云搭配zerotier保姆级教学,保证学废

Li Hongyi machine learning (2021 Edition)_ P7-9: training skills

Website log collection and analysis process

Uni-app 小程序 App 的广告变现之路:Banner 信息流广告

Simple explanation of database table connection

Zhimi Tencent cloud live mlvb plug-in optimization tutorial: six steps to improve streaming speed + reduce live delay

ks 怎么抓salt值?api,did?

不止直播:腾讯云直播MLVB 插件除了推流/拉流还有哪些亮眼功能

李宏毅机器学习(2017版)_P3-4:回归
随机推荐
07 - setup and attack of log server
6. 世界杯来了
SQL learning (1) - table related operations
小程序直播、连线直播、直播打赏:腾讯云移动直播组件MLVB多场景直播拓展
数据库期中(二)
Applet live broadcast, online live broadcast, live broadcast reward: Tencent cloud mobile live broadcast component mlvb multi scene live broadcast expansion
以赛促练-力扣第303场周赛反思
The difference between forward and redirect
New experience of mlvb cloud live broadcast: millisecond low latency live broadcast solution (with live broadcast performance comparison)
PlantCV中文文档
Choose RTMP or RTC protocol for mobile live broadcast
Android -- Data Persistence Technology (III) database storage
Contextcompat. Checkselfpermission() method
创建MDK工程
As 5g becomes more and more popular, what positive effects will our lives be affected
adb.exe已停止工作 弹窗问题
浅析ContentValues
Redisson working principle - source code analysis
Jenkins--基础--03--安装后设置向导
Jenkins -- Basic -- 5.3 -- system configuration -- global security configuration