欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

oracle_面試題01

系統(tǒng) 1868 0

完成下列操作,寫出相應(yīng)的SQL語句

創(chuàng)建表空間neuspace,數(shù)據(jù)文件命名為neudata.dbf,存放在d:\data目錄下,文件大小為200MB,設(shè)為自動增長,增量5MB,文件最大為500MB。(8分)
答:create tablespace neuspace datafile ‘d:\data\neudata.dbf’ size 200m auto extend on next 5m maxsize 500m;
2. 假設(shè)表空間neuspace已用盡500MB空間,現(xiàn)要求增加一個數(shù)據(jù)文件,存放在e:\appdata目錄下,文件名為appneudata,大小為500MB,不自動增長。(5分)
答:alter tablespace neuspace add datafile ‘e:\appdata\appneudata.dbf’ size 500m;
3. 以系統(tǒng)管理員身份登錄,創(chuàng)建賬號tom,設(shè)置tom的默認表空間為neuspace。為tom分配connect和resource系統(tǒng)角色,獲取基本的系統(tǒng)權(quán)限。然后為tom分配對用戶scott的表emp的select權(quán)限和對SALARY, MGR屬性的update權(quán)限。(8分)
答:create user tom identified by jack default tablespace neuspace;
Grant connect, resource to tom;
Grant select, update(salary, mgr) on scott.emp to tom;
4. 按如下要求創(chuàng)建表class和student。(15分)
屬性
類型(長度)
默認值
約束
含義

CLASSNO 數(shù)值 (2) 無 主鍵 班級編號
CNAME 變長字符 (10) 無 非空 班級名稱
屬性
類型(長度)
默認值
約束
含義

STUNO 數(shù)值 (8) 無 主鍵 學(xué)號
SNAME 變長字符 (12) 無 非空 姓名
SEX 字符 (2) 男 無 性別
BIRTHDAY 日期 無 無 生日
EMAIL 變長字符 (20) 無 唯一 電子郵件
SCORE 數(shù)值 (5, 2) 無 檢查 成績
CLASSNO 數(shù)值 (2) 無 外鍵,關(guān)聯(lián)到表CLASS的CLASSNO主鍵 班級編號
答:create table class
(classno number(2) constraint class_classno_pk primary key,
cname varchar2(10) not null);
create table student
(stuno number(8) constraint student_stuno_pk primary key,
sname varchar2(12) not null,
sex char(2) default ‘男’,
birthday date,
email varchar2(20) constraint student_email_uk unique,
score number(5,2) constraint student_score_ck check(score>=0 and score<=100),
classno number(2) constraint student_classno_fk references class(classno)
);
5. 在表student的SNAME屬性上創(chuàng)建索引student_sname_idx(5分)
答:create index student_sname_idx on student(sname);
6. 創(chuàng)建序列stuseq,要求初值為20050001,增量為1,最大值為20059999。(6分)
答:create sequence stuseq increment by 1 start with 20050001 maxvalue 20059999 nocache nocycle;
7. 向表student中插入如下2行。(5分)
STUNO SNAME SEX BIRTHDAY EMAIL SCORE CLASSNO
從stuseq取值 tom 男 1979-2-3 14:30:25 tom@163.net 89.50 1
從stuseq取值 jerry 默認值 空 空 空 2
答:insert into student values(stuseq.nextval, ’tom’, ’男’, to_date(‘1979-2-3
14:30:25’, ’yyyy-mm-dd fmhh24:mi:ss’), ’tom@163.net’, 89.50, 1);
insert into student (stuno, sname, classno) values(stuseq.nextval, ’jerry’, 2);
8. 修改表student的數(shù)據(jù),將所有一班的學(xué)生成績加10分。(4分)
答:update student set score=score+10 where classno=1;
9. 刪除表student的數(shù)據(jù),將所有3班出生日期小于1981年5月12日的記錄刪除。(4分)
答:delete from student where classno=3 and birthday > ’12-5月-81’;
10. 完成以下SQL語句。(40分)
(1) 按班級升序排序,成績降序排序,查詢student表的所有記錄。
答:select * from student order by classno, score desc;
(2) 查詢student表中所有二班的成績大于85.50分且出生日期大于1982-10-31日的男生的記錄。
答:select * from student where classno=2 and score>85.50 and birthday < ’31-10月-82’ and sex=’男’;
(3) 查詢student表中所有三班成績?yōu)榭盏膶W(xué)生記錄。
答:select * from student where classno=3 and score is null;
(4) 表student與class聯(lián)合查詢,要求查詢所有學(xué)生的學(xué)號,姓名,成績,班級名稱。(使用oracle與SQL 99兩種格式)
答:select s.stuno, s.sname, s.score, c.cname from student s, class c where s.classno=c.classno;
(5) 按班級編號分組統(tǒng)計每個班的人數(shù),最高分,最低分,平均分,并按平均分降序排序。
答:select classno, count(*), max(score), min(score), avg(score) from student group by classno order by avg(score) desc;
(6) 查詢一班學(xué)生記錄中所有成績高于本班學(xué)生平均分的記錄。
答:select * from student where classno=1 and score > (select avg(score) from student where classno=1);
(7) 統(tǒng)計二班學(xué)生中所有成績大于所有班級平均分的人數(shù)。
答:select count(*) from student where classno=2 and score > all (select avg(socre) from student group by classno);
(8) 查詢平均分最高的班級編號與分數(shù)。
答:select classno, avg(score) from student group by classno having avg(score) = (select max(avg(score)) from student group by classno);
(9) 查詢所有學(xué)生記錄中成績前十名的學(xué)生的學(xué)號、姓名、成績、班級編號。
答:select stuno, sname, score, classno from (select * from student order by score desc) where rownum<=10;
(10) 創(chuàng)建視圖stuvu,要求視圖中包含student表中所有一班學(xué)生的stuno, sname, score, classno四個屬性,并具有with check option限制。
答:create view stuvu
as
select stuno, sname,score,classno from student where classno=1 with check option;

oracle_面試題01


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!??!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 婷五月综合 | 偷拍—91porny九色 | 激情福利视频 | 亚洲精品乱码久久久久久 | 污视频在线免费播放 | 午夜在线电影 | 天天爆操 | 正在播放国产无套露脸 | 亚洲一区二区三区免费视频 | 久久国产精品视频 | 手机看片日韩国产 | 四虎1515hh永久久免费 | 精品视频在线观看视频免费视频 | 精品国产一区二区三区性色av | 日本香蕉一区二区三区 | 欧美日韩福利视频 | 黄在线免费 | 久久91精品 | 欧美成人一区二区 | 久久中文字幕网站篠田优 | 国产黄色麻豆视频 | 国产精品成人观看视频国产 | 日韩在线播放一区 | 国产精品久久久久久久7电影 | 亚洲黄色一级大片 | 成人无码T髙潮喷水A片小说 | 久久99国产伦子精品免费 | 日本成片| 美女污视频网站 | 极品逼 | 天堂va在线高清一区 | 精品欧美在线 | 亚洲网站一区 | 久久亚洲这里只有精品18 | 国产精品入口免费视频 | 成人九色 | 色一欲一性一乱一区二区三区 | 免费在线成人 | 久碰人澡人澡人澡人澡91 | 国产福利不卡 | 国产精品亚洲第一 |