CS319 Theory of Databases Content of the Module 1 Content of The
Total Page:16
File Type:pdf, Size:1020Kb
Content of the module 1 GENERAL BACKGROUND TO DATABASES … 0. Preface to the Theory of Databases preface 1. Generalities on Databases intro CS319 Theory of Databases 2. Ingres and Quel ingres 3. Relational Database Models RelMod [4. SQL sql ] Course Review [5. SQL-EDDI worksheets <cs233 website> ] 2004-2005 5/10/2005 1 CS319 Theory of Databases 5/10/2005 2 CS319 Theory of Databases Content of the module 2 Content of the module 3 RELATIONAL THEORY: ALGEBRA-CALCULUS RELATIONAL DATABASE DESIGN … [10. Entity-relationship modelling ERmodel ] 6. Introduction to Relational Calculus relcalc 11. Decomposition of relational schemes decomp 7. Query optimisation opt 12. Functional Dependency depend 8. From Relational Calculus to Algebra drelcalc 13. Relational Database Design RDBdesign 9. Relational Query languages / modelling state relql [14. Normal Forms RDBdesignNF ] 5/10/2005 3 CS319 Theory of Databases 5/10/2005 4 CS319 Theory of Databases Content of the module 4 Preface CRITIQUE AND EVALUATION … Principal theme of the Theory of Databases module: The OO and 3rd Gen Database Manifestos How do theory and computing practice relate with [Tim Heron : OO and Object-Relational DBs] specific reference to databases? Hugh Darwen: The Relational Model and SQL General orientation especially useful for the two essay questions 1 and 2: Mick Ridley’s reflections Hugh Darwen: Temporal data and the Relational Model Motivation for 15. Why relational? whyrel • study of relational theory 16. Why not relational? whynotrel • discussion of practice and historical context 17. Evaluating the manifestos evalMan 5/10/2005 5 CS319 Theory of Databases 5/10/2005 6 CS319 Theory of Databases Generalities on Databases Relational Databases Review • Ingres and QUEL ingres What is a database? • Relational Database Models RelMod the database manager module • SQL + SQL-EDDI sql users, including DBA data abstraction: logical / physical data independence Relational query languages conceptual models for databases scope of expressive power of DDL and DML Two views of a database: examples: QUEL, SQL and ISBL comparison end-user and application programming environment special characteristics of relational data models means to record external real-world state Alternative data modelling approaches hierarchical, network, object-oriented, E-R etc 5/10/2005 7 CS319 Theory of Databases 5/10/2005 8 CS319 Theory of Databases Relational Theory Relational Query Languages • Introduction to Relational Calculus relcalc Relational Query Languages – Modelling State relql • From Relational Calculus to Algebra drelcalc End-user programming using RQLs Mathematical definition of relations Relational algebra operations and completeness Modelling real-world state using RQLs Relational calculus: tuple and domain, safety Codd’s Fundamental Theorem of Relational Theory Extras: converting from relational algebra to calculus CODASYL slides whyrel (12-20) Optimisation opt converting from relational calculus to algebra 5/10/2005 9 CS319 Theory of Databases 5/10/2005 10 CS319 Theory of Databases Relational Database Design 1 Relational Database Design 2 • Relational Database Design RDBdesign • Relational Database Design - NFs RDBdesignNF • Functional Dependency depend • Decomposition of relational schemes decomp • Decomposition of relational schemes decomp Normal forms and anomalies Theory of database design update, insertion/deletion anomalies functional dependency 3NF, BCNF, 4NF, 5NF Armstrong’s axioms, minimal covers data dependencies beyond functional dependencies lossless and dependency-preserving decompositions Decomposition algorithms (taking account of FDs) Algorithm for constructing a minimal cover lossless join decomposition into BCNF Algorithm for lossless join / dependency preserving lossless, dependency preserving decomposition 3NF 5/10/2005 11 CS319 Theory of Databases 5/10/2005 12 CS319 Theory of Databases Theory and Practice of Database Critique Format of the Examination Paper Resources for theory and practice critique The exam paper has no special sections: OO and 3rd-generation manifestos There are 7 questions in all: you answer 4 Hugh Darwen: www.thethirdmanifesto.com Every answer is marked out of 25 The Relational Model and SQL Temporal Data and the Relational Model First two questions on the paper are essay • Why relational? whyrel questions • Why not relational? whynotrel The topics of these questions are briefly • Evaluating the manifestos evalMan introduced on the module website Extras: Entity-relationship modelling ERmodel 5/10/2005 13 CS319 Theory of Databases 5/10/2005 14 CS319 Theory of Databases Essay Themes for 2004-2005 Temporal Tutorial D: a brief reprise 1 Exercises designed to help you prepare for essays in Qu 1 and 2: Example of a temporal tutorial D database: Exercise 1: Review Ridley’s critique of DB theory and practice. S_DURING (S#, DURING) Issues: what Codd's theory did in the 1970s; how academic - records when a staff member was employed by the and commercial developments have influenced practice; how university over the period 1980-2000 DB theory relates to data modelling in CS (e.g. with reference to data structures and algorithms, and OO modelling). SM_DURING (S#, M#, DURING) Exercise 2: What is the ideal relational query language? – taking - records when a staff member was responsible for account of: the demands made upon RQLs by DB applications teaching the module with code M# from 1980-2000 as they were initially and have evolved over time; what Codd's relational theory commends for RQL design; your knowledge of RQLs (and SQL and its design flaws in particular); Tutorial D. DURING is of type ‘interval_year’ 5/10/2005 15 CS319 Theory of Databases 5/10/2005 16 CS319 Theory of Databases Temporal Tutorial D: a brief reprise 2 Temporal Tutorial D: a brief reprise 3 Typical query: The query USING (DURING) !SM_DURING {M# , DURING} " USING (DURING) !SM_DURING {M# , DURING} " SM_DURING {M# , DURING} is a Tutorial D for projection returns the periods during which the modules were Special brackets (!") are an 'operation invocation modifier'. being taught, in the form of a relation (M#, DURING), where the tuples take the form (module_code, Interpretation of the query: interval_year) where interval_year is such that the 1. unpack the operand(s) on DURING module is not recorded as being taught immediately 2. Evaluate the relational op invocation on unpacked forms prior or after the specified interval. 3. Pack the result on DURING 5/10/2005 17 CS319 Theory of Databases 5/10/2005 18 CS319 Theory of Databases Temporal Tutorial D: a brief reprise 4 Temporal Tutorial D: a brief reprise 5 To frame such queries Other ingredients to be familiar with - need to know some basic Tutorial D syntax • U_key constraints: e.g. S_DURING(S#, DURING) USING (DURING) KEY(S#, DURING) MINUS USING(DURING) FOREIGN_KEY {S#, DURING} SM_DURING(S#, DURING) REFERENCES returns when S# employed but not teaching S_DURING - need to know about predicates on intervals e.g. • “horizontal decomposition”: for temporal extension to … WHERE DURING INCLUDES [1985,1991] present day introduce an auxiliary table: SM_SINCE(S#, M#, SINCE) 5/10/2005 19 CS319 Theory of Databases 5/10/2005 20 CS319 Theory of Databases.