当前位置:首页 » 数据仓库 » 大学数据库入门期末考试操作题2021年
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

大学数据库入门期末考试操作题2021年

发布时间: 2022-05-29 05:50:10

数据库 试题

一、1.B 2.B 3.A 4.B 5.B 6.D 7.D 8.A 9.B 10.C 11.D 12.B 13.C
二、21.查询 22.授权机制 23.DROP 24.联系 25.定义 26.日志文件

后面几道接触较少,让高手来补足吧

❷ 数据库操作题,求大神。只要答案不需要解释

  1. sql 的 DDL 语言创建 S 表,SNo 为主键,SN 不能为空。 CREATE TABLE S1 ( SNo CHAR(6) NOT NULL CONSTRAINT PK_S PRIMARY KEY, SN CHAR(6) NOT NULL, Sex CHAR(2), Age INT, Dept CHAR(20) );

  2. 创建计算机系学生的视图,该视图的属性列由学号、姓名、课程号和任课教师号组成。 CREATE VIEW FROM WHERE AND AND S,SC,TC S.SNo = SC.SNo SC.CNo=TC.CNo S.Dept = '计算机'; V_COMS(SN0,SN,CNo,TNo) AS SELECT S.SNo, SN, SC.CNo, TNo

3.检查计算机系年龄在 20 岁以上的学生学号。 SELECT SNo FROM S WHERE Age >20 AND Dept = '计算机';

4.检索姓王的教师所讲课程的课程号及课程名称。 SELECT TC.CNo, WHERE AND AND CN FROM T, TC, C T.TNo = TC.TNo TC.CNo = C.CNo T.TN LIKE '王%';

5. 检索张三同学所学课程的成绩、列出 SN,CNo 和 Score。 SELECT SN, SC.CNO, FROM WHERE AND S, SC S.SNo = SC.SNo SN = '张三'; Score

6. 检索总收入超过1000 元的教师所讲课程的学生姓名、课程号和成绩。 SELECT FROM WHERE AND AND AND SN, SC.CNo, Score S, SC, TC, T S.SNo = SC.SNo SC.CNo = TC.CNo TC.TNo = T.TNo (COMM + SAL ) > 1000;

8.S1 同学选修了 C3,将此信息插入 SC 表中。 INSERT INTO 或 INSERT SC VALUES('S1','C3',null) SC(SNo,CNo) VALUES('S1','C3') INTO

10.删除 S 表中没有选修任何课程的学生记录。 DELETE FROM S WHERE SNo NOT IN( SELECT DISTINCT SNO FROM SC );

❸ 数据库期末考试题 编写SQL语句 1.创建一张学生表,包含以下信息,学号,姓名,年龄,性别,家庭住址,联系

create table 学生表
(
学号 char(10) primary key,
姓名 char(10),
年龄 int,
性别 char(2) check (sex IN ('男','女')),
家庭住址 char(40),
联系 char(20)
)

❹ 求大神,数据库操作题

-- Create table

create table student

(

student_id varchar2(20),

student_name varchar2(20),

student_sex varchar2(20),

student_dept varchar2(20)

)

;

-- Create table

create table student_score

(

student_id varchar2(20),

course_num varchar2(20),

course_score number(20)

)

;

insert into student(student_id, student_name, student_sex, student_dept) values('2010', 'test', '女, '管理系);

delete from student where student_id = '05002';

update student_score set course_score = course_score + 5 where student_id = '13005';

select * from student where student_sex = '男 and student_dept = '管理系;

select * from student_score where course_num = 'A001' order by course_score desc;

drop table student;

前两个是建表语句,后面六条是你要的答案

❺ 数据库操作题

是foxpro?工作第一年有接触,没用多久,下面的主要提供SQL和方式方法,供借鉴。
1.select 姓名,简历 from zgda where 婚否=1 and 性别='女'
2.update zgda set 工资=工资+300 where 工资<1600
update zgda set 工资=工资+500 where 工资>=1600
3.delete zgda where id=8(这个其实不太记得foxpro怎样删除第八条记录)
pack
4.select 姓名,工资 from ZGDA order by 工资 desc(分屏不知道foxpro怎样实现)
5.select * from ZGDA where 姓名='王明'

❻ 数据库期末考试

如下 (PS:简单起见全部使用的varchar2 有些按需要可改成int )
[oracle@rhel3 admin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Proction on Fri Apr 10 13:21:11 2015

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Proction
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> create table student(sno varchar2(10) primary key,sname varchar2(20),ssex char(2),sbirthday varchar2(20),sdept varchar2(20));
Table created.
SQL> create table courses(cno varchar2(10) primary key,cname varchar2(20),ccredit varchar2(10));
Table created.
SQL> create table sc(sno varchar2(10),cno varchar2(10),grade varchar2(10));
Table created.
SQL> alter table sc add constraint pk_sc primary key (sno,cno);
Table altered.

1 select sno,sname from student;
2 select sno,sname,sdept from student;
3 select * from student;
4 select sno,sbirthday from student;
5 select sno,sbirthday,lower(sdept) sdept from student;
6 select sno xingm,sbirthday csrqi,sdept xim from student;
7 select distinct(sno) from student where sno in (select sno from sc where cno in (select cno from courses where cpno is not null));
8 select * from student where sdept='jisuanji';
9 .1 select sname,round(months_between(sysdate,to_date(sbirthday,'yyyy-mm-dd')),0)/12 nianji from student where sbirthday<add_months(sysdate,-12*20);
9.2 select sname,round(months_between(sysdate,to_date(sbirthday,'yyyy-mm-dd')),0)/12 nianji from student where months_between(sysdate,to_date(sbirthday,'yyyy-mm-dd'))/12<20;
10 select distinct(sno) from sc where grade<'60';
未完待续......看的真累
11 select sname,sdept,round(months_between(sysdate,to_date(sbirthday,'yyyy-mm-dd')),0)/12 nianlin from student where months_between(sysdate,to_date(sbirthday,'yyyy-mm-dd'))/12 between 20 and 30;
12 select sname,sdept,round(months_between(sysdate,to_date(sbirthday,'yyyy-mm-dd')),0)/12 nianlin from student where months_between(sysdate,to_date(sbirthday,'yyyy-mm-dd'))/12 <20 or months_between(sysdate,to_date(sbirthday,'yyyy-mm-dd'))/12>30;
13 select sname,ssex from student where sdept in ('xinxi','shuxue','jisuanji');
14 select sname,ssex from student where sdept not in ('xinxi','shuxue','jisuanji');
15 select * from student where sno like '95001%';
16 select sname,sno,ssex from student where sname like 'liu%';
17 select sname from student where sname like 'ouyang%' and length(sname)=6;
18 select sname,sno from sutdent where substr(sname,2,1)='yang';

19 select sname from student where sname not like 'liu%';

20 select cno,ccredit from courses where cname like 'C%';
21 select cno,credit from courses where cname like 'H%' and substr(cname,length(cname)-3,1)='T';
歇会....................
22 select sno,cno from sc where cno in (select cno from courses where cpno is not null) and grade is null;
23 select sno,cno from sc where grade is null;
24 select sname from student where sdept='jisuanji' and (months_between(sbirthday,sysdate)/12)<20;
25 select sname,ssex from student where sdept='jisuanji' or sdept='shuxue' or sdept='xinxi';
26 select sno,grade from sc where cno='3' order by grade desc;
27 select * from student order by sdept asc,sbirthday desc;
28 select count(1) from student;
29 select count(sno) from sc where cno in (select cno from courses where cpno is not null);
30 ...........
PS : courses 那个表好像建表的时候多打了个s

❼ 大一ACCESS数据库的操作题,高手快来帮忙吧。

用汇总查询,如下:

❽ 数据库期末考试题 求答案 急!

--1
create database 学生选课系统
on primary
(name = 学生选课系统_data,
filename='d:\aa\学生选课系统.mdf',
size=8,
maxsize=100,
filegrowth=20%)
log on
(name =学生选课系统_log,
filename = 'e:\ee\学生选课系统.ldf')

--2
create table 学生
(学号 char(10) primary key,
姓名 char(20),
性别 char(2) check (性别 in('男','女')),
年龄 int default 20,
所在系 char(20))

--3
select 学号,年龄
from 学生
where 所在系='物理系'

--4
select 学号,成绩
where 课程号='2'
order by 成绩 asc,学号 desc

--5
select 学生.学号 学号,姓名,选修的课程名,成绩
from 学生,课程,选课
where 学生.学号=选课.学号 and 课程.课程号=选课.课程号

--6
insert into 学生(学号,姓名,所在系)
values('96002','张三','英语系')

--7
update 学生 set 年龄=年龄+3

--8
delete from 学生
where 所在系='化学系'

--9
create view 英语系学生
as
select 学号,性别,年龄
from 学生
where 所在系='英语系'

--10
create unique index IX_课程号 on 课程(课程号)

--11
create trigger trig1 on 学生
for delete
as
declare @SID char(10)
select @SID=学号 from deleted
begin
delete from 选课 where 学号=@SID
end