Winter 2002Arthur Keller – CS 1801–1 Computer Science 180: Database Systems Arthur M. Keller (best way to reach me) Office: Baskin.

Slides:



Advertisements
Similar presentations
1–1 Students Entity/Relationship Model Diagrams to represent designs. Entity like object, = “thing.” Entity set like class = set of “similar” entities/objects.
Advertisements

Entity-Relationship Model
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
The E-R Model CS 157A Lecture 4 Prof. Sin-Min Lee
1 Entity-Relationship Model Diagrams Class hierarchies Weak entity sets.
Databases : Relational Model 2007, Fall Pusan National University Ki-Joune Li These slides are made from the materials that Prof. Jeffrey D. Ullman distributes.
Chapter 4 Notes. Entity-Relationship Model E/R Diagrams Weak Entity Sets Converting E/R Diagrams to Relations.
Design Principles: Faithfulness
Entity-Relationship Model. The process of designing a database begins with: –an analysis of what information the database must hold, and –the relationships.
Design Principles: Faithfulness
1 Relational Model and Translating ER into Relational.
Winter 2002Arthur Keller – CS 18015–1 Schedule Today: Feb. 28 (TH) u Datalog and SQL Recursion, ODL. u Read Sections , Project Part 6.
Entity-Relationship Model Lecture 2. Database Modeling and Implementation Process Ideas ER DesignRelational Schema Relational DBMS Implementation.
System Concepts and Architecture Rose-Hulman Institute of Technology Curt Clifton.
1 IS380 Class Agenda 01/11/05 Sock H. Chung 1.Syllabus 2.Chapter 1 3.Introduction 4. Request.
Winter 2002Arthur Keller – CS 18016–1 Schedule Today: Mar. 5 (T) u More ODL, OQL. u Read Sections 9.1. Assignment 7 due. Mar. 7 (TH) u More OQL. u Read.
Entity-Relationship Model
1 Database Systems (Part I) Introduction to Databases I Overview  Objectives of this lecture.  History and Evolution of Databases.  Basic Terms in Database.
Introduction to Databases
Winter 2002Arthur Keller – CS 18018–1 Schedule Today: Mar. 12 (T) u Semistructured Data, XML, XQuery. u Read Sections Assignment 8 due. Mar. 14.
Fall 2001Arthur Keller – CS 1801–1 Computer Science 180: Database Systems Arthur M. Keller (best way to reach me) Office: Baskin.
Entity-Relationship Data Model Alex Ostrovsky. Presentation Overview ► Short historical overview ► Elements of E-R Model ► Basic organization & relationships.
Fall 2001Arthur Keller – CS 1802–1 Schedule Today Sep. 25 (T) u More Entity-Relationship Model. u Read Sections Note: Sep. 27 (TH) Class cancelled.
1 Lecture 31 Introduction to Databases I Overview  Objectives of this lecture  History and Evolution of Databases  Basic Terms in Database and definitions.
Introduction to Database Systems
Fall 2001Arthur Keller – CS 1803–1 Schedule Today Oct. 2 (T) Relational Model. u Read Sections Assignment 1 due. Personal Letter of Introduction.
1 Entity-Relationship Model Diagrams Class hierarchies Weak entity sets.
Winter 2002Arthur Keller – CS 1802–1 Schedule Today: Jan. 8 (T) u Weak Entity Sets, Entity-Relationship Design. u Read Sections Jan. 10 (TH) u.
CENG 352 Database Management Systems Instructor: Nihan Kesim Çiçekli URL:
Database Management COP4540, SCS, FIU Database Modeling Using the Entity-Relationship Model (Chapter 3)
CS411 Database Systems Kazuhiro Minami
CSC343H – Introduction to Databases
What is a Database Management System? 1. Manages very large amounts of data. 2. Supports efficient access to very large amounts of data. 3. Supports concurrent.
Database System Concepts and Architecture Lecture # 3 22 June 2012 National University of Computer and Emerging Sciences.
Winter 2002 Judy Cushing, Art Keller, Jeff Ullman 1–1 Database Systems Lecture/Workshop: Mon 1-3 LIB 1316; Wed 11 – 12, LH2 Lab: Thu 10-12, ACC, additional.
1 CS222: Principles of Database Management Fall 2010 Professor Chen Li Department of Computer Science University of California, Irvine Notes 01.
Santa Clara UniversityCOEN 178 Holliday1–1 COEN 178 Database Systems JoAnne Holliday (best way to reach me) Office: Engineering.
Chapter 1 Databases Introduction The content 1).Database Application 2).Database concept 3).An example of database 4).Function of DBMS 5).DBMS product.
Entity-Relationship Model
1 CS 430 Database Theory Winter 2005 Lecture 1: Introduction.
LiaoNing ShiHua University
CSET 3300 Databases & ER Data Models. Databases A database is a collection of data (information). A DataBase Management System (DBMS) is a software system.
Introduction to Database Systems Fundamental Concepts Irvanizam Zamanhuri, M.Sc Computer Science Study Program Syiah Kuala University Website:
Databases : Entity-Relationship Model 2007, Fall Pusan National University Ki-Joune Li These slides are made from the materials that Prof. Jeffrey D. Ullman.
1 Entity-Relationship Model Chapter 2 Copyright : Jeff Ullman + Hank Korth.
Lecture2: Database Environment Prepared by L. Nouf Almujally & Aisha AlArfaj 1 Ref. Chapter2 College of Computer and Information Sciences - Information.
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
Tallahassee, Florida, 2015 COP4710 Database Systems E-R Model Fall 2015.
Entity-Relationship Model
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 2 Introduction to a First Course in Database Systems.
Dale Roberts 11/26/ Department of Computer and Information Science, School of Science, IUPUI Fall 2003 Dale Roberts, Lecturer Computer Science, IUPUI.
Databases 1 Fifth lecture. Entity-Relationship Model Diagrams Class hierarchies Weak entity sets From E/R diagrams to Relations 2.
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 4 Introduction to a First Course in Database Systems.
The Entity-Relationship Model CIS 4301 Lecture Notes 1/12/2006.
Entity-Relationship Model E/R Diagrams Converting E/R Diagrams to Relations.
ASET 1 Amity School of Engineering & Technology B. Tech. (CSE/IT), III Semester Database Management Systems Jitendra Rajpurohit.
Lecture 3 A short revision of ER and EER modelling See R. Elmasri, S.B. Navathe. Fundamentals of Database Systems (third edition) Addison-wesley. Chapter.
CS422 Principles of Database Systems Entity-Relationship Model Chengyu Sun California State University, Los Angeles.
A short revision on entity- relationship modelling.
A short review on entity- relationship modelling.
Database Design and Programming Jan Baumbach Adopted from previous slides of Peter Schneider-Kamp.
CS422 Principles of Database Systems Entity-Relationship Model Chengyu Sun California State University, Los Angeles Adapted from Jeffrey Ullman’s lecture.
CS422 Principles of Database Systems Entity-Relationship Model
CENG 352 Database Management Systems
Entity-Relationship Model
CPSC-310 Database Systems
The Entity-Relationship Model
CPSC-310 Database Systems
CPSC-310 Database Systems
Presentation transcript:

Winter 2002Arthur Keller – CS 1801–1 Computer Science 180: Database Systems Arthur M. Keller (best way to reach me) Office: Baskin Engineering 153a, (831) Office Hours: Tuesdays 4:30–5:30pm and by appointment Class web page: My web page: Assignments due most Tuesdays; Project Parts due most Thursdays T.A. – T.J. Steed

Winter 2002Arthur Keller – CS 1801–2 Textbooks Required: Database Systems: The Complete Book, by Garcia-Molina, Ullman, and Widom (first edition), Prentice Hall, Recommended: (one of these) A Guide to the SQL Standard: A User's Guide to the Standard Database Language SQL, (fourth edition), by C.J. Date and Hugh Darwen, Addison-Wesley, SQL: Understanding Relational Language Components, (first edition), by Melton and Simon, Morgan Kaufmann, PostgreSQL: Introduction and Concepts, Bruce Momjian, Addison-Wesley, You may also want: Books on Unix, Perl, PHP, and CGI.

Winter 2002Arthur Keller – CS 1801–3 Grading Assignments: 2% each = 16% of grade. Project: 5% each = 35% of grade. Midterm: Feb. 14 (TH) in class. 14% of grade. Final: Mar. 16 (Sa) 12–3PM in class. 35% of grade.

Winter 2002Arthur Keller – CS 1801–4 Project You will build an application using a relational database system (PostgreSQL) accessed via the web. The project has 7 parts (due most Thursdays), starting with design and ending up with a complete application. The early programming assignments should be written in C, C++ or Java. Some students found it helpful to switch to PHP or Perl for the final project.

Winter 2002Arthur Keller – CS 1801–5 Warning This class is a lot of work. But it is worth it. Of all courses you take at UCSC, this may be the one that gets you a job.

Winter 2002Arthur Keller – CS 1801–6 Schedule Today: Jan. 3 (TH) u Intro, Entity-Relationship Model. u Read Chapter 1 and Sections Jan. 8 (T) u Weak Entity Sets, Entity-Relationship Design. u Read Sections Jan. 10 (TH) u Relational Model, Functional Dependencies. u Read Sections Jan. 15 (T) u Normal Forms, Multivalued Dependencies. u Read Sections Assignment 1 due.

Winter 2002Arthur Keller – CS 1801–7 Syllabus The background and history of database management systems. The fundamentals of using a database management systems. Industry standards used for database management systems. Theoretical background of the relational model. Queries and Updates. Logic databases. Transactions and Security. Object-oriented, object-relational, semi-structured and XML database systems. Mediation and warehousing.

Winter 2002Arthur Keller – CS 1801–8 What is a Database Management System? 1. Manages very large amounts of data. 2. Supports efficient access to very large amounts of data. 3. Supports concurrent access to very large amounts of data. u Example: bank and its ATM machines. 4. Supports secure, atomic access to very large amounts of data. u Contrast two people editing the same UNIX file – last to write “wins” – with the problem if two people deduct money from the same account via ATM machines at the same time – new balance is wrong whichever writes last.

Winter 2002Arthur Keller – CS 1801–9 Relational Model Based on tables, as: acct #namebalance 12345Sally Sue …… … Today used in most DBMS's.

Winter 2002Arthur Keller – CS 1801–10 The DBMS Marketplace Relational DBMS companies – Oracle, Sybase – are among the largest software companies in the world. IBM offers its relational DB2 system. With IMS, a nonrelational system, IBM is by some accounts the largest DBMS vendor in the world. Microsoft offers SQL-Server, plus Microsoft Access for the cheap DBMS on the desktop, answered by “lite” systems from other competitors. Relational companies also challenged by “object-oriented DB” companies. But countered with “object-relational” systems, which retain the relational core while allowing type extension as in OO systems.

Winter 2002Arthur Keller – CS 1801–11 Three Aspects to Studying DBMS's 1. Modeling and design of databases. u Allows exploration of issues before committing to an implementation. 2. Programming: queries and DB operations like update. u SQL = “intergalactic dataspeak.” 3. DBMS implementation. CS180 = (1) + (2), while (3) is covered partly in CS277.

Winter 2002Arthur Keller – CS 1801–12 Query Languages Employee NameDept Department DeptManager SQL SELECT Manager FROM Employee, Department WHERE Employee.name = "Clark Kent” AND Employee.Dept = Department.Dept Query Language Data definition language (DDL) ~ like type defs in C or Pascal Data Manipulation Language (DML) Query (SELECT) UPDATE SET = WHERE

Winter 2002Arthur Keller – CS 1801–13 Host Languages C, C++, Fortran, Lisp, COBOL Application prog. Local Vars DBMS Calls to DB Host language is completely general (Turing complete) but gives you no support Query language—less general "non procedural" and optimizable (Memory) (Storage)

Winter 2002Arthur Keller – CS 1801–14 Relational model is good for: Large amounts of data —> simple operations Navigate among small number of relations Difficult Applications for relational model: VLSI Design (CAD in general) CASE Graphical Data CPU ALU ADDER Adder A FA ALU ADDER Bill of Materials or transitive closure

Winter 2002Arthur Keller – CS 1801–15 Where number of "relations" is large, relationships are complex Object Data Model Logic Data Model OBJECT DATA MODEL 1.Complex Objects – Nested Structure (pointers or references) 2.Encapsulation, set of Methods/Access functions 3.Object Identity 4.Inheritance – Defining new classes like old classes Object model: usually find objects via explicit navigation Also query language in some systems

Winter 2002Arthur Keller – CS 1801–16 LOGIC (Horn Clause) DATA MODEL Prolog, Datalog if A1 and A2 then B prolog B:- A1 and A2 Functions s(5) = 6 (successor) Predicates with Arguments sum(X,Y,Z) X + Y = Z sum(X,0,X) means X + 0 = X (always true for all X) sum(X,s(Y),s(Z)):-sum(X,Y,Z) means X+(Y+1) = (Z+1) if X + Y = Z More power than relational Can Compute Transitive Closure edge(X,Y) path(X,Y) :- edge(X,Y) path(X,Z) :- path(X,Y) & edge(Y,Z)

Winter 2002Arthur Keller – CS 1801–17 Hierarchical 60’s 70's 80's 90’s now Relational Choice for most new applications Object BasesKnowledge Bases Network

Winter 2002Arthur Keller – CS 1801–18 Students Entity/Relationship Model Diagrams to represent designs. Entity like object, = “thing.” Entity set like class = set of “similar” entities/objects. Attribute = property of entities in an entity set, similar to fields of a struct. In diagrams, entity set  rectangle; attribute  oval. ID namephone height

Winter 2002Arthur Keller – CS 1801–19 Relationships Connect two or more entity sets. Represented by diamonds. StudentsCourses Taking

Winter 2002Arthur Keller – CS 1801–20 Relationship Set Think of the “value” of a relationship set as a table. One column for each of the connected entity sets. One row for each list of entities, one from each set, that are connected by the relationship. StudentsCourses SallyCS180 SallyCS111 JoeCS180 ……

Winter 2002Arthur Keller – CS 1801–21 Multiway Relationships Usually binary relationships (connecting two E.S.) suffice. However, there are some cases where three or more E.S. must be connected by one relationship. Example: relationship among students, courses, TA's (and graders). Possibly, this E/R diagram is OK: StudentsCourses Taking Assisting TA/Graders

Winter 2002Arthur Keller – CS 1801–22 Works in CS180, because each TA (or grader) is a TA of all students. Connection student-TA is only via the course. But what if students were divided into sections, each headed by a TA? u Then, a student in CS180 would be related to only one of the TA's for CS180. Which one? Need a 3-way relationship to tell.

Winter 2002Arthur Keller – CS 1801–23 StudentsCoursesTAs AnnCS180Jan SueCS180Pat BobCS180Jan ……… Students Courses TAs Enrolls

Winter 2002Arthur Keller – CS 1801–24 Beers-Bars-Drinkers Example Our running example for the course. nameaddrlicense namemanfnameaddr BeersDrinkers Bars Serves Frequents Likes

Winter 2002Arthur Keller – CS 1801–25 Multiplicity of Relationships Representation of Many-One E/R: arrow pointing to “one.” u Rounded arrow = “exactly one.” Many-many Many-oneOne-one

Winter 2002Arthur Keller – CS 1801–26 Example: Drinkers Have Favorite Beers nameaddrlicense namemanfnameaddr BeersDrinkers Bars Serves Frequents Likes Favorite

Winter 2002Arthur Keller – CS 1801–27 One-One Relationships Put arrows in both directions. Design Issue: Is the rounded arrow justified? Design Issue: Here, manufacturer is an E.S. In earlier diagrams it is an attribute. Which is right? ManfsBeers Best- seller

Winter 2002Arthur Keller – CS 1801–28 Attributes on Relationships Shorthand for 3-way relationship: BarsBeers Sells price BarsBeers Sells price Prices

Winter 2002Arthur Keller – CS 1801–29 A true 3-way relationship. u Price depends jointly on beer and bar. Notice arrow convention for multiway relationships: “all other E.S. determine one of these.” u Not sufficiently general to express any possibility. u However, if price, say, depended only on the beer, then we could use two 2-way relationships: price-beer and beer-bar. u Or better: just make price an attribute of beer.

Winter 2002Arthur Keller – CS 1801–30 Converting Multiway to 2-Way Baroque in E/R, but necessary in certain “object-oriented” models. Create a new connecting E.S. to represent rows of a relationship set. u E.g., (Joe's Bar, Bud, $2.50) for the Sells relationship. Many-one relationships from the connecting E.S. to the others. BarsBeers The- Bar Price The- Beer The- Price BBP

Winter 2002Arthur Keller – CS 1801–31 Roles Sometimes an E.S. participates more than once in a relationship. Label edges with roles to distinguish. HusbandWife d 1 d 2 d 3 d 4… Drinkers Married husbandwife

Winter 2002Arthur Keller – CS 1801–32 Notice Buddies is symmetric, Married not. u No way to say “symmetric” in E/R. Design Question Should we replace husband and wife by one relationship spouse? Buddy1Buddy2 d 1 d 2 d 1 d 3 d 2 d 1 d 2 d 4… Drinkers Buddies 12

Winter 2002Arthur Keller – CS 1801–33 More Design Issues 1. Subclasses. 2. Keys. 3. Weak entity sets. (Next class.)

Winter 2002Arthur Keller – CS 1801–34 Subclasses Subclass = special case = fewer entities = more properties. Example: Ales are a kind of beer. In addition to the properties (= attributes and relationships) of beers, there is a “color” attribute for ales.

Winter 2002Arthur Keller – CS 1801–35 E/R Subclasses Assume subclasses form a tree (no multiple inheritance). isa triangles indicate the subclass relation. namemanf Beers Ales color isa

Winter 2002Arthur Keller – CS 1801–36 Different Subclass Viewpoints 1. E/R viewpoint: An entity has a component in each entity set to which it logically belongs. u Its properties are the union of the properties of these E.S. 2. Contrasts with object-oriented viewpoint: An object (entity) belongs to exactly one class. u It inherits properties of its superclasses. namemanf Beers Ales color isa Pete’s Ale

Winter 2002Arthur Keller – CS 1801–37 Multiple Inheritance Theoretically, an E.S. could be a subclass of several other entity sets. namemanf Beers namemanf Wines Grape Beers isa

Winter 2002Arthur Keller – CS 1801–38 Problems How should conflicts be resolved? Example: manf means vintner for wines, bottler for beers. What does manf mean for “grape beers”? Need ad-hoc notation to resolve meanings. In practice, we shall assume a tree of entity sets connected by isa, with all “isas” pointing from child to parent.

Winter 2002Arthur Keller – CS 1801–39 Keys A key is a set of attributes whose values can belong to at most one entity. In E/R model, every E.S. must have a key. u It could have more than one key, but one set of attributes is the “designated” key. In E/R diagrams, you should underline all attributes of the designated key.

Winter 2002Arthur Keller – CS 1801–40 Example Suppose name is key for Beers. Beer name is also key for ales. u In general, key at root is key for all. namemanf Beers Ales color isa

Winter 2002Arthur Keller – CS 1801–41 Example: A Multiattribute Key Possibly, the combination of hours + room also forms a key, but we have not designated it as such. deptroom Courses numberhours