數(shù)據(jù)庫(kù)上機(jī)考試題-含答案.doc_第1頁
數(shù)據(jù)庫(kù)上機(jī)考試題-含答案.doc_第2頁
數(shù)據(jù)庫(kù)上機(jī)考試題-含答案.doc_第3頁
數(shù)據(jù)庫(kù)上機(jī)考試題-含答案.doc_第4頁
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

游戲開發(fā)商 Game_Company結(jié)構(gòu):idChar(5) not nullpknamevarChar2(100) not nullcountryvarChar2(100) 數(shù)據(jù):idnamecountry00001世嘉日本00002盛大中國(guó)00003任天堂美國(guó)游戲 Game結(jié)構(gòu):idChar(4) not nullpkcompanyIdChar(5) not nullFk :Game_Company的idnamevarChar2(100) not nulltypevarChar2(50)數(shù)據(jù):idcompanyIdnametype900100001惡狼傳說格斗900200001櫻花大戰(zhàn)90%益智900300002GT賽車競(jìng)技900400003口袋妖怪益智900500003俄羅斯方塊益智900600003馬力歐益智900700003口袋妖怪競(jìng)技游戲者 Player結(jié)構(gòu):useridChar(3) not nullpkusernamevarChar2(50) not nullgameidChar(4) not nullFk :Game_Company的id數(shù)據(jù):useridusernamegameid001張三9003002李四9002003陳奇9001004王照9005005鄭明9006006胡倩9006007李夢(mèng)9007008馬林90061. 創(chuàng)建game 表的結(jié)構(gòu);表名定義為表名+自己的姓名;create table database_java1_test.game_XXX( idChar(4), companyIdChar(5) not null, namevarChar(100) not null, typevarChar(50);2. 向game表中的主外鍵;alter table database_java1_test.game add primary key (id);alter table database_java1_test.gameadd constraint fk_game_companyforeign key (companyId) references database_java1_test.game_company (id) ;3. 添加game表的數(shù)據(jù);【9008, 00003, 超級(jí)瑪麗, 動(dòng)作】Insert into game values (9008, 00003, 超級(jí)瑪麗, 動(dòng)作);4. 更新game表數(shù)據(jù),把9008游戲名更新為 超級(jí)瑪麗升級(jí)版;Update game set name=超級(jí)瑪麗升級(jí)版 where id=9008;5. 統(tǒng)計(jì)各個(gè)游戲類別的游戲數(shù)量;Select name, count(*) from game group by name;6. 查詢每個(gè)游戲商家生產(chǎn)的游戲個(gè)數(shù),以及廠商名,國(guó)家;select t0.id, , t0.country, t.totalnum from game_company t0, (select companyid, count(*) totalnum from game group by companyid) twhere t0.id=panyid7. 查詢玩家最少的游戲名;select t0.id, , t1.minnum from game t0, (select t.gameid, min(t.totalnum) minnum from (select gameid, count(*) totalnum from player group by gameid) t) t1where t0.id=t1.gameid;8. 查詢游戲名帶有%的游戲select * from game where name like %;9. 查詢沒有人玩的游戲 select * from game g where g.id not in (select distinct p.gameid from player p)10. 查詢玩家最多的三個(gè)游戲名;select t0.id, , t.totalnum from game t0, (select gameid, count(*) totalnum from player group by gameid order by totalnum desc, gameid asc limit 3) twhere t0.id=t.gameid;數(shù)據(jù)drop table Player;drop table Game;drop table Game_Company;create table Game_Company( id Char(5) not null primary key, namevarChar2(100) not null, countryvarChar2(100);create table Game( idChar(4)primary key, companyIdChar(5) not null, namevarChar2(100) not null, typevarChar2(50);create table Player( useridChar(3) primary key, usernamevarChar2(50) not null, gameidChar(4) not null); insert into game values (9001,00001,惡狼傳說,格斗); insert into game values (9002,00001,櫻花大戰(zhàn)90%,益智); insert into game values (9003,00002,GT賽車,競(jìng)技); insert into game values (9004,00003,口袋妖怪,益智); insert into game values (9005,00003,俄羅斯方塊,益智); insert into game values (9006,00003,馬力歐,益智); insert into game values (9007,00003,口袋妖怪,競(jìng)技);insert into Game_Company values(00001,世嘉,日本);insert into Game_Company values(00002,盛大,中國(guó));insert into Game_Company values(00003,任天堂,美國(guó));insert into Player values(001,張三,9003);insert into Player values(002,李四,9002);insert into Player values(003,陳奇,9001);insert into Player values(004,王照,9005);inse

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論