Database Theory: Lecture 1 Introduction and the Relational Model Background Database Models This Lecture Course

Database Theory: Lecture 1 Introduction and the Relational Model Background Database Models This Lecture Course

Background A database model contains the means for ¡ Specifying particular data structures ¡ Constraining the data sets Database Theory: Lecture 1 ¡ Manipulating the data Introduction and the relational model A DDL (Data Definition Language) provides the means to specify the structures and constraints. Dr G.M. Bierman A DML (Data Manipulation Language) provides the means to manipulate the data; specifically querying and updating. www.cl.cam.ac.uk/Teaching/2002/DBaseThy Database Theory 2003 1 c GMB/AD Database Theory 2003 2 c GMB/AD ¢ Database models This lecture course Database models are typically characterized by the prominent data structure, e.g. We will study some of these database models from a theoretical perspective. ¥ £ Graphs: Study closely the data model Network model – ¥ Study closely the associated query languages: – Semantic model – Choices of query languages – Object model – Relationships between them – XML (?) – Their characteristics (typically expressivity) £ Trees: Three database models considered in this course: – Hierarchical model 1. Relational £ Relations: 2. Object – Relational model 3. Semi-structured/XML Database Theory 2003 3 c GMB/AD Database Theory 2003 4 c GMB/AD ¦ ¤ Warning Books This is a brand new course! Recommended textbooks: There will be eight lectures, two examples classes, and two lecturers! ¨ Foundations of databases Abiteboul, Hull and Vianu. Addison Wesley, 1995 Schedule: ¨ Data on the web Abiteboul, Buneman and Suciu. Morgan Kaufmann, 2000. 1. GMB - (now!) relational model Also: Some useful information in any of the database books from the IB 2. AD - Relational calculus Databases course. 3. AD - Deductive databases 4. AD - Recursion and negation 5. AD - Expressivity and complexity 6. GMB - Complex values 7. GMB - Object model 8. GMB - Semistructured/XML model Database Theory 2003 5 c GMB/AD Database Theory 2003 6 c GMB/AD © § What is the relational model? Codd 70: – Data structure: flat relations – Simple algebra of queries The relational model – No constraints – No updates Codd 72-: – Same data structure – Second query language (based on FOL) – Proof of equivalence to algebra language – Integrity constraints - functional dependencies Database Theory 2003 7 c GMB/AD Database Theory 2003 8 c GMB/AD What is the relational model? cont. Basics Therafter a whole host of extensions. Thus the relational model means the class Fix a countably infinite set of attribute names, with a total order of database models that have relations as the core data structure and incorporate Fix a single countably infinite set : the underlying domain some of Codd's approach. Fix a countably infinite set of relation names Assume that there is a sort for each element of , i.e. a function ! . " # The arity of a relation $ is then defined %&' ( 01 & ( + + ) * ,.- / * , / A relation schema is just a relation name. We may write $ 3 to denote $ is 2 4 5 of sort 3 , and $ to denote it is of arity 265 4 A database schema is just a nonempty finite set of relation schema, e.g. 8 < < < 3 $ 3 $ 7 : : = = ; ; 4> 2 9 2 4 Database Theory 2003 9 c GMB/AD Database Theory 2003 10 c GMB/AD ? Example relations Choicepoint: names Q: Are the attribute names part of the explicit database schema or not? F H P AB CD E IJ A CK IQ ER A B I AU T C @ M M S M O O G L N L N L NV In SQL they are available, e.g. SELECT p.Name FROM Persons p Movies Title Director Actor Magnolia Anderson Moore Guide Title Cinema Time But are they compiled away by the system to just integers? Magnolia Anderson Cruise Rocky Warner 12:00 More theoretically: Spiderman Raimi Maguire Spiderman Picturehouse 19:00 X _ ]^ : A tuple over relation schema Y [ is a map from [ to Named Z \ Spiderman Raimi Dunst ... ... Spiderman Phoenix 19:00 X : A tuple over relation schema Y is a element of the cartesian Unnamed Z6` \ Rocky Avildsen Stallone Magnolia Picturehouse 22:00 _ba product ]^ RockyII Stalone Stallone The choice of model impacts on the query language. Location Cinema Address Tel Having assumed a total order on the attribute names provides us with a Picturehouse Cambridge 504444 correspondence between the two. Thus we'll flip between the two during this Phoenix Oxford 512526 course Warner Cambridge 560225 Database Theory 2003 11 c GMB/AD Database Theory 2003 12 c GMB/AD c W Database Database Theor Theor A (Simplest SPC y y quer 2003 2003 y quer © ª Ê possib is y « well-f ² © ª ¦ © ª d le Ar © ª ormed algebr © ª ity ¦ ¤ «  ² e ¶ ÃÄ Å µ e f Å ¥ ¦ h h h h h Å ³ » ¶ · ¦ Unnamed: judgements Ä § ¨ a ¤ « ® wr ¸ ¶ first) ¹ Æ g u n n d z ¦ © ² ij6k t « ¦ ¹ ¼ º o v o p o p a ² « ¹ ³ º ´ À schema ¦ ¾ w x lm q t x ½ Á d x ´ Á r r w d o y d Á s s ½ r d ´ s SPC Ë ¿ º f or 15 13 if Base Car Projection Select Select Singleton there © ª SPC © ª algebr tesian ª © relation « e ² (attr (constant) © ª xists À ² « © ª ¦ constant quer À È ² product ib ¦ a µ ute) Ì · ¶ ¬­ ® ¦ such ² Ç « ¿ ies ³ » ª © ¯° ¹ « ² « relation ¦ ® º that ± » É ² Ç ¦ « ¼ » ¹ Ë Í ´ ½ ¾ º Ê Î Ì . Ï { c c GMB/AD GMB/AD Database Database Theor Theor ý þ Aside: What Alter List | Ð y y Ð ë 2003 2003 } ÿ á ìí î | the ~ î nativ î Ð Ð Ð à Ð à ä Ð ð is Ð 6 í ~ ¡£¢ Some á â á â Ð name ÐÛÜ Ý this? 6 á ely: ¤ ó ï é ã ÿ ä ô Ù ä Ù ä Ù ä } Ð Ð Ñ Þß Ú Ú Ú ¥¦§ quer (Assume | and Ò Ò Ò Ò Ò Ò Ò Ò Ó Ò Ó Ò Ó Ò Ó Ò Ó Ó 6 ¨ 6 ies © addresses ÔÕ Ö ÔÕ Ö ÔÕ Ö ÔÕ Ö ÔÕ Ö ÔÕ Ö × × × × × × can 6 Ý ÛÜ ÛÜ Û å Û å ÛÜ } Ø | å å retur is } Ù Ñ Almodo ~ æ æ of è ð Ù6õ Ù Almodo Þß Ú of ð ~ ä ä ñ Ú ò Ð Ð n ar Ð Ð Ú ñ ò â ò cinemas Ò Ò 6 ò ü ity ò Ò Ó Ò Ó Semantics ò ã Example f v or å å ñ å ç ç ð ñ ar å v ) ar all â Ù è Ù è Ù ö è Ù Ú Ú instances ñ ÷ Ú é pla Ý × × where Ú å 16 14 Þ Ù6õ ying å ß ç Ù ê Ó ñ Ú ò ò Úß æ ò a , ä Ð Ð Almodo ñ ÷ ù ú ù ú e ¡¢ Ò .g. Ò Ó ß Ù ø ä ä ð û ð û Ú Þ v å ø ö ar ç film æ ä Ð ð Ð Ò Ò Ó ñ ÷ æ ô ä Ð Ð Ò Ò Ó ß £ c c GMB/AD GMB/AD Database Database Theor Theor Ex 2. 1. 3. 2. 1. p p p p p y y er 2003 2003 + F Code Equijoin Generaliz Inter A W Note: W Recall: Of e cise – .g. or . e e natur " f W malise or ha wr / } ~ 0 section - e'll m 1 up W ite v al 1 e T e need uples these 2 3 them to join } do ed the where ensure 4 5 not Selection 3 oper to semantics are as oper where be allo , ! Gener ator e functions 0 that ators .g. ab w " 1 le ! Named repeated re ucv 2 6 the # to v of $ " eals 4 w 0 rename aliz 5 result the 6 # x q 1 % $ y z itself: % to equijoin 2 3 $ ed % names 5 3 of w rs perspectiv % BC { % attr # & $ a | D 7 8 % SPC join t quer 19 17 ib 2 6 where oper in # & utes on 9: 4 a y 5 3 ; <= and the relation ator algebr does E # * > ; ? common 5 ' 6 e is not @ ( @ + sor a " ha 5 ) 6 t and v - 8 7 attr e . repeated # * ib 9: utes is ; A = + " > ; ? names , @ @ or , F c c GMB/AD GMB/AD Database Database Theor Theor quer Pr where Define SPJR y y oposition 2003 2003 y h i \ an quer ] ^ j G SPC in H I ] _ K y J 1 nor K K F nor J ` a H L mal or MNO mal e ] Ncb v f or er P f m or Q y ] d Named: RS d (e m such d xtended) T to ] ^ c be U Nor that S U U a e T quer k k O mal N N f h SPC SPJR l lnm P Q y V d ] of quer f d 20 18 k S R or k d h i the f algebr ms j ] T Base Natur Renaming Projection Select Select Singleton y l l f g h . or S W , X m there al relation M Y (attr (constant) join a Q constant e ib T xists utes) U U U an T relation Y e xtended Z [ [ o c c GMB/AD GMB/AD Database Database Theor Theor × × × y y 2003 2003 A where Nor Can Ø Ù corresponding Ú mal Û Ü define Ü Ü ó Û Ù f or ô õ Ý Þß m: similar Sor ¡ ¢ ö ÷ ¡ ¢ àcá ¢ ¡ ¡ ¢ ¡ ¢ ß â ã nor t ô « £ £ £ ¡ ¢ « gener « á µ judgements ä « ¬ mal ¡ ¢ µ ÀÁ â ­ ® â åæ ô ø £ µ ø ¯ alizations ¦ f ø or çè « ¿ º ° £ ¦ « ¡ ô £ á ¤ ­ m ± ¡ ¢ é »¼ ½ ½ theorem ê é ½ µ æ é ¼ µ  ² ¶ çè ¶ ­ More « ¿ ß £ ¶ ù to ¾ ß ¦ ¿ ² ° ¡ ¢ f SPC « àcá £ or ¿ ± ú 23 21 ¦ · ¡ ¢ ¡ ¢ ª ¸ ê â £ ã SPJR « ø ô algebr ø ¡ ¢ µ ø ² ¶ ä ¬ ¤¥§¦ ¶ ô ê ­ ® £ ¶ ú ¡ ¢ ¦ ¦ æ å ¦ à a û ² ´ æ Ä ¨ ° quer ° çè £ « « · ©ª £ £ £ « ² ³ and ¹ ± ± distinct ¦ ë Å á ì Þ§í ° ies ü î are ± Þ ï Ú distinct â ð çè é é é çè í ý Æ c c GMB/AD GMB/AD î ñ Þ ï ò ð ð ð Database Database Theor Theor The W Where Aside 3.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    47 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us