Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Oracle Database wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Concurrency control wikipedia , lookup
Microsoft SQL Server wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Relational algebra wikipedia , lookup
Functional Database Model wikipedia , lookup
Clusterpoint wikipedia , lookup
Versant Object Database wikipedia , lookup
CS 319: Theory of Databases: Exam preparation Dr. Alexandra I. Cristea http://www.dcs.warwick.ac.uk/~acristea/ Structure • 3 hours, 100% of module mark • You will answer FOUR questions out of six. • This year’s exam format is here. • Read carefully *all* text of a question. • look at: the exams given previously. (the uni doesn’t have them anymore!) Books • See also Database System Concepts (DSC), 5th Edition, Silbershatz, Korth, Sudarshan – Or 6th edition equivalent – chapters mentioned in the following • See also: Hugh's book based on CS252, a free download from BookBoon.com Topics 1. Database generalities, Functional Dependencies, (Non-)Redundancy, Closure, Cover 2. Armstrong Axioms, Decompositions 3. Relational Algebra, query optimization 4. Tuple calculus, Domain calculus, Query equivalence 5. SQL and the relational model, How not to Use NULLs 6. Temporal Databases 1. Database generalities, Functional Dependencies, (Non)Redundancy, Closure, Cover • What do I need to know? • Database generalities : – Introduction – AIC; see also DSC Chapter 1: Introduction • Functional Dependencies : – Proving FD - AIC; see also DSC Chapter 7: Relational Database Design • (Non-)Redundancy, Closure, Cover: – Proving (Non)Redundancy; Closure, Cover – AIC; see also DSC Chapter 7: Relational Database Design 2. Armstrong Axioms, Decompositions • What do I need to know? • Armstrong Axioms – Armstrong - CompleteSound – AIC ; see also DSC Chapter 7: Relational Database Design – See also other examples • Decompositions – Decompositions: Dependency Preserving, Lossless Join ; see also DSC Chapter 7: Relational Database Design – See all NF simple description – See also a paper on the subject 3. Relational Algebra, query optimization • What do I need to know? • Relational Algebra: – RA-AIC; see also DSC Chapter 2: Relational Model • Query Optimisation: – Query Optimization- AIC; see also DSC Chapter 14: Query Optimization 4. Tuple calculus, Domain calculus • What do I need to know? • Tuple Calculus – Tuple Calculus – AIC • Domain Calculus – Domain Calculus – AIC • Query equivalence – Query equivalence - AIC 5. SQL and the relational model, How not to Use NULLs • What do I need to know? • SQL and the relational model – The Askew Wall (SQL and The Relational Model) pay attention to the international standard! – Slides – Notes • How not to Use NULLs – How to Handle Missing Information Without Using NULL – Slides – Notes • See also: Hints regarding exam questions on Hugh's lectures • See also: Past exam questions 6. Temporal Databases • What do I need to know? • Temporal Data – Temporal Data and The Relational Model – Slides – Notes – Pay attention to the 2011 temporal extension to SQL • See also: Hints regarding exam questions on Hugh's lectures • See also: Past exam questions • See also: Exercises on Temporal Data • Questions? 19 Q&A • Will each topic contain questions from all subjects mentioned in the title? – No. They represent the pool of information from which questions are asked. See also last year’s exam. • How long should I spend on one topic? – Max around 45 min (45*4=180min = 3 hours) • Why are there differences in structure to previous year? – Regulations. Also due to the overlap with CS253, less emphasis is put on the overlapping topics. • ‘See Also’: what do I do with them? – Make sure you read them at least once. There will be no questions directly related to those parts (unless definitions are given specifically), but it helps contextualise the information. 20 Beer database • serves(k,b) : bar k serves beer b • likes(d,b) : drinker d likes beer b • visits(d,k) : drinker d visits bar k Beer question (tupel calculus) • Give all beers that are served in bars where none of the visitors like any other beer (than the ones served in that bar). • Is this a correct answer? {t | s S ( s[b] t[b] v V ((v[k ] s[k ]) (l L((l[d ] v[d ]) (ss S ( ss[k ] s[k ] l[b] ss[b])))))} A faulty answer • Consider {t | s S ( s[b] t[b ] v V (v[ k ] s[ k ] l L (l [d ] v[ d ] l[ b] s[b])))} • Or after a rewrite {t | s S ( s[b] t[b ] v V (v[k ] s[k ] l L( l[ d ] v[d ] l[ b] s[b])))} • Suppose there are 2 beers a, b, 1 bar k, 2 drinkers x, y; everyone serves/visits/likes everything Then the correct answer should result in {a, b}. The tupel calculus expression does not contain a, because every visitor of k also likes b. Beer question (RA) • Give all beers that are served in bars where none of the visitors like any other beer (than the ones served in that bar). • b(S (k(S) - k( V L - V L S))) • This is not so easy to translate to the earlier TC expression Common tupel calculus mistakes • Explain what is wrong in the following queries: 1. {t | s S (s[b] t[b] v V (l L(l[b ] s[b])))} 2. {t | s S (s[b] t[b] l L(l[b ] s[b] v V (l[d ] s[d ])))} 3. {t | s S ( s[b] t[b] v V (v[k ] s[k ] l L (l[d ] v[d ] ss S ( s[k ] ss[k ] ss[b] l[b]))))} 4 { t | s S ( s [ b ] t [ b ] ) v V ( v [ k ] s [ k ] . . . ) } 5 ( t | s S ( s [ b ] t [ b ] l L ( l [ b ] s [ b ] ) ) ) 6 {t | s S ( s[b] t[b] v V (v[k ] s[k ] l L( v[d ] l[d ] l[b] s[b])))} 7 { s | s S v V ( d [ k ] s [ k ] l L ( v [ d ] l [ d ] l [ b ] k [ b ] ) ) } 8 {s | s S (v : v V v[ k ] s[ k ] : ( l : l L : v[ d ] l[ d ] ( w : w S w[k ] s[ k ] l[b] w[b])))} t | s S ( t [ b ] s [ b ] v V ( l L ( v [ b ] l [ b ] ) ) ) } 9 { 10 {t | s S ( t[b ] s[ b]) v V (v[k ] s[k ]) l L( l[b ] s[ b] v[ d ] l[ d ])} 11 {t | s S ( s[b] t[b ] v V (v[k ] s[k ] l L (l[ d ] v[ d ] r S ( r[ k ] v[k ] r[b] v[ b]))))} 12 {t | t bar serves(beer , drinkr )} 13 {t | s S (t [b] s[b ] v V ( v[ k ] s[ k ] l L (l[ d ] v[ d ] l[b ] s[ b])))} 14 {t | s S ( s[b] t[b ] v V (v[ k ] s[ k ] l L( l[b ] s[ b] l [d ] v[ d ])))} t | v V ( s S ( v [ k ] s [ k ] t [ k ] l L ( l [ b ] s [ b ] t [ d ] l [ d ] ) ) ) } 15 { 16 {t | l L( s S (l[b ] s[b ] v V ( v[ d ] s[ d ] v[ k ] s[ k ] t[b] s[b ])))} t | s S ( s [ b ] t [ b ] v V ( v [ k ] s [ k ] l L ( l [ b ] s [ b ] ) ) ) } 17 { 18 {t | l L( s S (l [b] s[b] v V ( v[ d ] s[ d ] v[ k ] s[k ] t [b] s[b])))}