SQL——数据库实验一
来源:互联网 发布:女用避孕套 知乎 编辑:程序博客网 时间:2024/05/29 17:19
create table student ( sno number primary key, sname varchar2(8) not null unique, sage int, ssex varchar2(8), sdept varchar2(10));create table course(cno number primary key,cname varchar2(10),cpno number,ccredit int);create table sc(sno number,cno number,primary key(sno,cno),grade smallint,foreign key(sno) REFERENCES student(sno),foreign key(cno) REFERENCES course(cno));alter table student add bloodtype varchar2(2);alter table student modify sdept varchar2(40);alter table student add constraint yueshu1 check(sage>15 and sage<30);alter table student drop constraint yueshu1;alter table student drop column bloodtype;create unique index stusnam4099 on student (sname);create index i_sc4099 on sc(sno,cno desc);drop index stusnam4099;drop index i_sc4099;insert into student(sno,sname,sage,ssex,sdept)values(200215121,'liyong',20,'m','cs');insert into student(sno,sname,sage,ssex,sdept)values(200215122,'liuchen',19,'f','cs');insert into student(sno,sname,sage,ssex,sdept)values(200215123,'wangmin',18,'f','ma');insert into student(sno,sname,sage,ssex,sdept)values(200215125,'zhangli',19,'m','is');insert into course(cno,cname,cpno,ccredit)values(1,'shujuku',5,4);insert into course(cno,cname,cpno,ccredit)values(2,'shuxue',null,2);insert into course(cno,cname,cpno,ccredit)values(3,'信息系统',1,4);insert into course(cno,cname,cpno,ccredit)values(4,'操作系统',6,3);insert into course(cno,cname,cpno,ccredit)values(5,'数据结构',7,4);insert into course(cno,cname,cpno,ccredit)values(6,'shujuchuli',null,2);insert into course(cno,cname,cpno,ccredit)values(7,'pascal',6,4);insert into sc(sno,cno,grade)values(200215121,1,92);insert into sc(sno,cno,grade)values(200215121,2,85);insert into sc(sno,cno,grade)values(200215121,3,88);insert into sc(sno,cno,grade)values(200215122,4,90);insert into sc(sno,cno,grade)values(200215122,3,80);update student set sage=20 where sname='wangmin';update student set sage=sage+1 ;update sc set grade = 0 where sno in(select sno from student where sdept='cs');delete from student where sdept = (select sdept from student where sname='liuchen'); delete from sc where sno in (select sno from student where sdept = 'cs');
阅读全文
0 0
- SQL——数据库实验一
- 哈工大数据库实验一sql查询
- 实验四 数据查询——简单查询 Sql Server数据库实验
- ORClE数据库实验 —
- 数据库实验一
- 数据库实验NetMusicShop(一)
- 数据库实验一
- sqlserver数据库实验一
- 【数据库】实验一
- 《数据库原理》实验一
- 数据库_实验一
- 数据库——PL/SQL(一)
- 实验一 数据库定义与操作语言——数据库管理系统原理与设计
- 数据库实验:使用sql语句
- sql手工注入实验一
- 数据库实验——3
- 数据库实验——1
- 数据库实验——2
- iOS开发之UI篇(3)—— UILabel
- linux下shell显示-bash-4.1#不显示路径解决方法
- 打印两个有序链表的公共部分 Python 版
- 高斯曲率求表面极值点
- 【Weblogic】Weblogic Server环境下JNDI命名服务
- SQL——数据库实验一
- 基础巩固--堆栈轨迹
- ubuntu mysql多实例配置
- 用Vim优雅的编辑
- Python 2和3
- java 中的e和e.printStackTrace()方法
- 关于Java泛型实现原理的思考与一般用法示例总结
- 产品测试过程
- JAVA | 18