


版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Exam of Database Technology & Applications1. Describe the three levels and data independence.2. What are key constraints and foreign constraints?3. Explain LEFT JOIN, OUTER JOIN and INNER JOIN.4. For the following relation schema and sets of FD s: R is (A, B, C, D,GE), wFith FD sA-> B, B->
2、 C, A-> E, CD->G.1) Identify the candidate key(s) for R.2) Identify the best normal form that R satisfies3) Decompose it in 3NF if necessary.75. Explain the ACID properties.6. Notown Records has decided to store information about musicians who perform on its albums (as well as other company da
3、ta) in a database. The company has chosen to hire you as a database designer.Each musician that records at Notown has an SSN, a name, an address, and aphone number.Each instrument used in songs recorded at Notown has a name (e.g., guitar, synthesizer,flute) and a musical key (e.g., C, B-flat, E-flat
4、).Each album recorded on the Notown label has a title, a copyright date, a format(e.g.,CD or MC), and an album identifier.Each song recorded at Notown has a title and an author.Each musician may play several instruments, and a given instrument may be played by several musicians.Each album has a numb
5、er of songs on it, but no song may appear on more thanone album.Each song is performed by one or more musicians, and a musician may perform a number of songs.Each album has exactly one musician who acts as its producer. A musician mayproduce several albums, of course.1) Defining the completed E-R di
6、agram.2) Defining information for each relation.7. Consider the followingrelational schema and give T-SQL expressions for the following queries.Sailors(sid, sname, age) Boats(bid, bname, color) Reservers(sid, bid , day)1)Create the table Sailors (sid, sname , age). It includes the domain of valuesas
7、sociated with each attribute and integrity constraints.sidsnameINTVARCHAR(10)NOT NULLNOT NULLPRIMARY KEYageINTNULL0<age<1002) Change the attribute sname AVRCHAR(12).3) Delete all tuples in the Sailors relation for sailors whose age is less than 18.4) Find the names of sailors who have reserved
8、 a boat on2010-1-1.5) Find the names of sailors who have reserved a red boat.6) Find the names of sailors who have reserved at least one boat.7) Find the sid of sailors who have reserved a red boat and a green boat.8) Find the names of sailors who have reserved all boats.8. Consider the Buys_compute
9、r Relation shown in Figure 1. The first four columns show the age and salary of a potential customer and the Buys_computer column shows whether the person buys a computer. We want to use this data to construct a decision tree that helps predict whether a person will buy a computer.AgeSalarySubscript
10、ionyouthhighnoyouthhighnomiddle_agedhighyesseniormediumyesseniorlowyesseniorlownomiddle_agedlowyesyouthmediumnoyouthlowyesseniormediumyesyouthmediumyesmiddle_agedmediumyesmiddle_agedhighyesseniormediumnoFigure 1 The Buys_computer RelationANSWER1. The three levels are physical level, logical level an
11、d view level. Physical level describes all relations that are stored in the database. Logical level summarizes how the relations are actually stored on secondary storage devices. Each view level consists of a collection of one or more views and relations from the conceptual level.There are actually
12、twomappings: the conceptual/internal mapping and the external/conceptual mapping. The conceptual/internal mapping lies between the conceptual and internal levels. If the structure of the stored database is changed, then the conceptual/ internal mapping must also be changed accordinglyso that the vie
13、w fromthe conceptual level remains constant. Itis thismapping that provides physical data independence for the database.The external/conceptual view lies between the external and conceptual levels. If the structure ofthe database at the conceptual level is changed, then the external/conceptual mappi
14、ng must change accordingly so the view from the external level remains constant. It is this mapping that provides logical data independence for the database.2. Primary key constraints assure that the keys of any two records are not same in a table. The primary key constraints enforce the entity inte
15、grity of the table.Foreign key constraints control the data that can be stored in the foreign key table, it also controls changes to data in the primary key table. This constraint enforces referential integrity by ensuring that changes cannot be made to data in the primary key table if those changes
16、 invalidate the link to data in the foreign key table.3. The LEFT OUTER JOIN includes all rows in the left table in the results, whether or not there is a match on the join column in the right table.FULL OUTER JOIN includes all rows from both tables, regardless of whether or not the othertable has a
17、 matching value.This INNER JOIN is known as an equi-join. It returns all the columns in both tables, and returns only the rows for which there is an equal value in the join column.4.1) (A,D) is the primary key for R2) R 1NF3) R1(A,B,E) ,R2(B,C,F),R3(C,D,G)5. Atomicity:This property guarantees that a
18、 set ofrecords that are part of a transaction is indivisible. Thus either all operations of the transaction are properly reflected in the database or none are.Consistency: Database consistency is the property that every transaction sees a consistent database instance. Database consistency follows fr
19、om transaction atomicity, isolation, and transaction consistency.Isolation: Although multiple transactions may execute concurrently, each transaction must beunaware of other concurrently executing transactions. Intermediate transaction results must be hidden from other concurrently executed transact
20、ions.Durability: After a transaction completes successfully, the changes it has made to the database persist, even if there are system failures.6.1)pruducemalbum11musiciancontainmmnmplayperformsongninstrument2)musician (SSN, m_name, address, phone number.) instrument ( i_name, musical key)album (a_t
21、itle, copyright date, format , album identifier, SSN)song ( s_title, author, a_title) play(SSN,i_name) produce(SSN, s_title)7.1) CREATE TABLE Sailors( sid INT PRIMARY KEY,sname VARCHAR(10) NOT NULL,age INT CHECK( age BETWWEN 0 AND 100)2) ALTER TABLE Sailors ALTER COLUMN sname VARCHAR(12)3) DELETE FR
22、OM Sailors WHERE age<184) SELECT sname FROM Sailors S JOIN Reserves R ON S.sid=R.sid WHERE rday='2010-1-1'5) SELECT snameFROM Sailors S JOIN Reserves R ON S.sid=R.sid JOIN Boats B ON B.bid=R.bidWHERE color='red'6) SELECT snameFROM Sailors S JOIN Reserves R ON S.sid=R.sid7) SELECT snameFROM Sailors S1 JOIN Reserves R1 ON S1.sid=R1.sid JOIN Boats B1 ON B1.bid=R1.bidWHERE B1.color='red' AND sid IN(SELECT sid FROM Sailors S2 JOIN Reserves R2
溫馨提示
- 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. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024-2030年中國激光牙齒漂白機(jī)行業(yè)市場(chǎng)深度分析及發(fā)展趨勢(shì)預(yù)測(cè)報(bào)告
- 2025年木制餐盒項(xiàng)目投資可行性研究分析報(bào)告
- 2025年舞臺(tái)設(shè)備項(xiàng)目安全評(píng)估報(bào)告
- 2024-2025學(xué)年高中政治第一單元生活與消費(fèi)第一課神奇的貨幣課時(shí)1揭開貨幣的神秘面紗課時(shí)精練含解析新人教版必修1
- 2024-2025學(xué)年高中生物第二章減數(shù)分裂和有性生殖第一節(jié)減數(shù)分裂第2課時(shí)生殖細(xì)胞的形成知能演練輕巧奪冠蘇教版必修2
- 中國立式高速刨花機(jī)項(xiàng)目投資可行性研究報(bào)告
- 2024-2025學(xué)年高中生物第三部分生物技術(shù)在食品加工中的應(yīng)用實(shí)驗(yàn)7用蒸氣蒸餾法從芳香植物中提全油略實(shí)驗(yàn)8果酒及果醋的制作知能演練輕巧奪冠浙科版選修1
- 2024-2025學(xué)年高中物理第十四章電磁波第1節(jié)第2節(jié)電磁振蕩練習(xí)含解析新人教版選修3-4
- 2024-2025學(xué)年高中化學(xué)專題4硫氮和可持續(xù)發(fā)展第二單元生產(chǎn)生活中的含氮化合物第3課時(shí)硝酸的性質(zhì)學(xué)案含解析蘇教版必修1
- 2020-2025年中國汽油機(jī)行業(yè)發(fā)展前景預(yù)測(cè)及投資戰(zhàn)略研究報(bào)告
- 《電子商務(wù)法律法規(guī)》電子商務(wù)專業(yè)全套教學(xué)課件
- 《產(chǎn)后出血預(yù)防與處理指南(2023)》解讀課件
- 全套教學(xué)課件《工程倫理學(xué)》
- 江蘇省建筑與裝飾工程計(jì)價(jià)定額(2014)電子表格版
- 清華大學(xué)考生自述
- 幼兒園中班繪本:《我喜歡我的小毯子》
- 級(jí)本科診斷學(xué)緒論+問診課件
- 熱導(dǎo)檢測(cè)器(TCD)原理與操作注意事項(xiàng)
- 初中足球選拔測(cè)試標(biāo)準(zhǔn)
- 法社會(huì)學(xué)(上課)
- 沉積學(xué)與古地理
評(píng)論
0/150
提交評(píng)論