資料庫機試題
❶ SQL資料庫試題~~~~~~~~~~
updateStudentsetsex='女'wherename='張三'returningageinto:var
❷ 跪解以下2道資料庫系統原理上機試題
borrower:
create table borrower(
借書證號 char[5] primary key,
姓名 char[20] not null,
系名 char[10],
班級 char[10])
create table loans(
借書證號 char[5],
圖書登記號 char[6],
結束日期 DATE,
primary key(借書證號,圖書登記號),
foreign key(借書證號) reference borrower(借書證號),
foreign key(圖書登記號 reference books(圖書登記號))
create table books(
索書號 char[10],
書名 char[20],
圖書登記號 char[6] primary key,
出版社 char[20],
價格 smallint))
(1)
select borrower.借書證號,姓名,系名,temp.total as 借書數量
from borrower,(select 借書證號,count(圖書登記號) as total
from loans group by 借書證號
where tatal>5 as temp(借書證號,total))
(2)
select borrower.姓名,系名,書名,結束日期
from borrower,loans,books
where borrower.借書證號=loans.借書證號
and books.圖書登記號=loans.圖書登記號
and 書名 in(selcet 書名
from borrower,loans,books
where borrower.借書證號=loans.借書證號
and books.圖書登記號=loans.圖書登記號
and 姓名='趙壘')
(3)
create view SB
as
select borrower.借書證號,姓名,班級,books.圖書登記號,書名,出版社
,借書日期
from borrower,book,loans
where borrower.借書證號=loans.借書證號
and books.圖書登記號=loans.圖書登記號
and 系名='信息系'
1
create table student(
sno char[10] primary key,
sname char[20] not null,
ssex char[2],
sage smallint check( sage between 16 and 30),
sdept char[4])
create table course(
cno char[10] primary key,
cname char[20] not null,
cteacher char[20])
create table sc(
sno char[10],
cno char[10],
grade smallint check(grade is null or grade between 0 and
100),
primary key(sno,cno)
foreign key sno reference student(sno),
foreign key cno reference course(cno))
2
insert into student values('102','李四','男',16,'數學')
下同
insert into course values('203','操作系統','程羽')
下同
insert into sc values('101','203',82)
下同
3
(1) select cname,grade
from sc,student,course
where student.sno=sc.sno and course.cno=sc.cno
and sname='張三'
(2) select sname from student
where sno in(select sno from sc x
where not exists(
select * from sc y
where x.sno=y.sno
and y.grade<60))
(3) select cname,sname,grade
from student,course sc,(select cno,max(grade) from sc group by cno
as temp(cno,max))
where student.sno=sc.sno and course.cno=sc.cno
and grade=max and course.cno=temp.cno
4
delete * from sc where grade<60
5
update sc
set grade=(select avg(grade) from sc where cno='203')
where sno=105
僅供參考
❸ 資料庫試題
1 、B
2、B
3、c
4、 delete
題3,注
real
近似數值型
real 數據類型像浮點數一樣,是近似數值類型。它可以表示數值在-3.40E+38到3.40E+38之間的浮點數
http://..com/link?url=WEQbFYg813wlu4_lFSWL-XSJZFrGSRzUzm-FuG1Zisrcou_9ZvwyemkIqICVK-AVTvydFrf5fd4FGhiDidz5UK
(裡面有的答錯,參考評論3)
❹ 計算機等級考試三級資料庫機試題難嗎
三級資料庫的上機是C語言,如果你沒有學過C,最好把C看一下,不過C++你都會的話這個不會很難。三級上機C還不如二級的上機難,都是些比較簡單的題目。筆試看書就好,我考的時候資料庫數據結構都沒學,自學就可以應付