CS122aSlides04

CS122aSlides04 - ICS122A / EECS116 Introduction to Data...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
1 ICS122A / EECS116 Introduction to Data Management Spring 2009 Prof. Mike Carey Bren School of ICS UC Irvine Slides based on previous CS122a lecture notes as well as  material borrowed from U-Wisconsin, Stanford, & Berkeley
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ICS122A/EECS116 Notes 02 2 Announcements HWs and projects Gradiance retry count = 3 (+2 due to HW#1 misinfo…!) Project Part 1 is now available online Discussion section meetings There is a discussion session meeting tomorrow AM Come ask questions on HW#1 and/or Project Part 1 Lectures Any lingering questions about the last lecture?
Background image of page 2
ICS122A/EECS116 Notes 03 3 Outline Relational model: Basic concepts Integrity constraints Mapping ER diagrams to relational schemas
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ICS122A/EECS116 Notes 03 4 Relational Model AccountId CustomerId Balance 150 20 11,000 160 23 2,300 180 23 32,000 Account CustomerId AccountId Balance 23 160 2,300 23 180 32,000 20 150 11,000 Account (No order in attributes or tuples)  Relation : account = { (150, 20, 11000), (160, 23, 2300), (180, 23, 32000) } Relation schema : R=(attributes) Account = (AccountId, CustomerId, Balance) Main Concepts: 1. Table: relation 2. Column: attribute 3. Row: tuple A database schema consists of 1. A set of relation schemas , e.g., S= (R1, R2… Rn) 2. A set of constraints over the relation schemas
Background image of page 4
ICS122A/EECS116 Notes 03 5 Attributes & Nulls Attributes: Each attribute has a domain The set of allowed values for each attribute Each attribute is atomic We cannot refer to or directly see a subpart of the value Composite values and multivalued attributes are not allowed The number of attributes is called the degree of the relation (while the number of tuples in a relation is called its cardinality ) Attributes can have a special value: NULL Can mean not known : we don’t know Jack’s address Or, does not exist : savings account 1001 does not have “overdraft” Id Name Addr 20 Tom Irvine 23 Jane LA 32 Jack NULL Customer(Id, Name, Addr)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ICS122A/EECS116 Notes 03 6 Constraints Why? Allow designers to specify the semantics of the data Enable DBMSs to check that new data satisfies the semantics Make application programmers’ lives easier If DBMS guarantees account >=0, the debit application programmer need not worry about overdrawn accounts Enable identification of redundancy in schemas Helps in good database design E.g., if we know course names are unique, then we may not need another “course id” attribute Help the DBMS in query processing Constraints can help the query optimizer choose a good query execution plan (e.g., by helping it with intermediate result size estimation)
Background image of page 6
ICS122A/EECS116 Notes 03 7 Constraints (cont.) Represent semantics of domains and restrict the set of possible database states E.g., account balance should be >= 0 Constraint types : Domain constraints Entity identity Key constraints Functional dependencies (generalization of key constraints) Referential integrity Inclusion dependencies (generalization of referential integrity)
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ICS122A/EECS116 Notes 03 8 Domain Constraints
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/18/2009 for the course CS 122a taught by Professor Carey during the Spring '09 term at UC Irvine.

Page1 / 35

CS122aSlides04 - ICS122A / EECS116 Introduction to Data...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online