CS 461: Database Systems. Midterm review. Julia Stoyanovich

Size: px
Start display at page:

Download "CS 461: Database Systems. Midterm review. Julia Stoyanovich"

Transcription

1 CS 461: Database Systems Midterm review Julia Stoyanovich

2 Sets Let us denote by M the set of all musicians, by R the set of rock musicians, by B the set of blues musicians, by G the set of musicians that won a Grammy award, and by V the set of musicians who won an MTV Video Music Award (VMA). (a) Blues musicians who won both a Grammy and a VMA. (b) Grammy-winning musicians whose genre is neither blues nor rock. (c) Musicians who won a VMA but not a Grammy, and whose genre is not rock. 2

3 Sets Let us denote by M the set of all musicians, by R the set of rock musicians, by B the set of blues musicians, by G the set of musicians that won a Grammy award, and by V the set of musicians who won an MTV Video Music Award (VMA). (a) Blues musicians who won both a Grammy and a VMA. B G V (b) Grammy-winning musicians whose genre is neither blues nor rock. G B R (c) Musicians who a VMA but not a Grammy, and whose genre is not rock. V G R 3

4 Sets Let us denote by M the set of all musicians, by R the set of rock musicians, by B the set of blues musicians, by G the set of musicians that won a Grammy award, and by V the set of musicians who won an MTV Video Music Award (VMA). (d) Grammy-winning musicians whose genre is either rock or blues but not both. (e) The number of pairs of musicians in which the first musician is a Grammywinning rock musician, and the second is a blues musician. 4

5 Sets Let us denote by M the set of all musicians, by R the set of rock musicians, by B the set of blues musicians, by G the set of musicians that won a Grammy award, and by V the set of musicians who won an MTV Video Music Award (VMA). (d) Grammy-winning musicians whose genre is either rock or blues but not both. G (R B) (R B) (e) The number of pairs of musicians in which the first musician is a Grammywinning rock musician, and the second is a blues musician. (G R) B 5

6 ER modeling Each musician who records at the studio has a social security number (SSN), a name, an address, and a phone number, and no two musicians have the same SSN. Poorly paid musicians often share the same address. Each musician has exactly one address and at least one phone number. Producers have a name and an SSN. No two producers have the same SSN. Albums are described by a title and a recording year, and no two albums have the same combination of title and year. Each album is recorded by one or several musicians. Each album has exactly one producer, and each producer produces at least one album. 6

7 ER modeling Each musician who records at the studio has a social security number (SSN), a name, an address, and a phone number, and no two musicians have the same SSN. Poorly paid musicians often share the same address. Each musician has exactly one address and at least one phone number. Producers have a name and an SSN. No two producers have the same SSN. Albums are described by a title and a recording year, and no two albums have the same combination of title and year. Each album is recorded by one or several musicians. Each album has exactly one producer, and each producer produces at least one album. 7

8 ER modeling Each musician who records at the studio has a social security number (SSN) and a name, and no two musicians have the same SSN. Musicians form bands. A band is described by a unique name and has at least two musicians as members. Bands record albums, which have a title, a genre, and a year of production. Each album is recorded by at least one band, and no two albums have the same combination of title and production year. Some musicians produce albums. Each album is produced by at least one musician. (Don t worry about whether that musician is a member of the recording band.) Albums are made up of songs. Each song is assigned a title and a sequence number. You may assume that, if the studio no longer wants to store information about an album, then it also does not store the songs belonging to that album. Naturally, each song belongs to exactly one album, and all songs on the same album have different sequence numbers. 8

9 ER modeling Each musician who records at the studio has a social security number (SSN) and a name, and no two musicians have the same SSN. Musicians form bands. A band is described by a unique name and has at least two musicians as members. Bands record albums, which have a title, a genre, and a year of production. Each album is recorded by at least one band, and no two albums have the same combination of title and production year. Some musicians produce albums. Each album is produced by at least one musician. (Don t worry about whether that musician is a member of the recording band.) Albums are made up of songs. Each song is assigned a title and a sequence number. You may assume that, if the studio no longer wants to store information about an album, then it also does not store the songs belonging to that album. Naturally, each song belongs to exactly one album, and all songs on the same album have different sequence numbers. 9

10 ER modeling An athlete has a name and a date of birth (DOB), and no two athletes have the same combination of name and DOB. A team is described by a name, and no two teams have the same name. A sport is described by a name, and contains information about whether it is an Olympic sport or not. All sports have different names. Each athlete plays at least one sport, and belongs to at most one team. Each team is made up of at least two athletes. 10

11 ER modeling An athlete has a name and a date of birth (DOB), and no two athletes have the same combination of name and DOB. A team is described by a name, and no two teams have the same name. A sport is described by a name, and contains information about whether it is an Olympic sport or not. All sports have different names. Each athlete plays at least one sport, and belongs to at most one team. Each team is made up of at least two athletes. 11

12 Relational to ER create table This ( B integer primary key create table That ( A integer primary key, B integer unique not null, C integer, foreign key (B) references This (B) create table Other ( A integer primary key, D integer not null, foreign key (A) references That (A) 12

13 Relational to ER create table This ( B integer primary key create table That ( A integer primary key, B integer unique not null, C integer, foreign key (B) references This (B) create table Other ( A integer primary key, D integer not null, foreign key (A) references That (A) 13

14 ER to relational 14

15 ER to relational create table This ( A integer, B integer, primary key (A, B) create table That ( C integer primary key, D integer, A integer not null, B integer not null, unique (A, B) foreign key (A, B) references This (A, B) 15

16 ER to relational name) field) DOB) num) 7tle) INVENTORS) have) PATENTS) name) country) posi7on) work)at) INSTITUTES) 16

17 ER to relational name) field) DOB) num) 7tle) INVENTORS) have) PATENTS) name) country) posi7on) work)at) INSTITUTES) create table Institutes ( name varchar(128) primary key, country varchar(64) create table Patents { inventor_name varchar(128), create table Inventors ( num integer, name varchar(128) primary key, title varchar(128), field varchar(128), primary key (inventor_name, num), DOB date, foreign key (inventor_name) institute_name varchar(128) not null, references Inventors(name) position varchar(64), on delete cascade foreign key (institute_name) references Institutes(name) 17

18 ER to relational name) party) name) PRESIDENT) running_mate) VICE_PRESIDENT) start) end) TERM) 18

19 ER to relational name) party) name) PRESIDENT) running_mate) VICE_PRESIDENT) start) end) TERM) create table All_In_One ( president_name varchar(128) primary key, VP_name varchar(128) not null, term_start date not null, term_end date not null, party varchar(64), unique (VP_name), unique (term_start, term_end), 19

20 ER modeling An author is described by a name and a date of birth (dob). No two authors have the same combination of name and dob. A book is described by an ISBN, a title and a year when it was written (year). No two books have the same ISBN number. A book is written by exactly one author. An author is only included in the database is she has authored at least one book. 20

21 ER modeling An author is described by a name and a date of birth (dob). No two authors have the same combination of name and dob. A book is described by an ISBN, a title and a year when it was written (year). No two books have the same ISBN number. A book is written by exactly one author. An author is only included in the database is she has authored at least one book. 21

22 ER modeling A scientist is described by a name, a field of study, and a date of birth (dob). No two scientists have the same combination of name and dob. A discovery has a name. No two discoveries have the same name. An award has a name, which uniquely identifies it. Scientists make discoveries. A discovery is made by one or several scientists. A scientist who made no discoveries is not tracked in our database. Scientists receive awards. A scientist may receive the same award more than once in different years. All years in which a scientist received a particular award must be recorded. 22

23 ER modeling A scientist is described by a name, a field of study, and a date of birth (dob). No two scientists have the same combination of name and dob. A discovery has a name. No two discoveries have the same name. An award has a name, which uniquely identifies it. Scientists make discoveries. A discovery is made by one or several scientists. A scientist who made no discoveries is not tracked in our database. Scientists receive awards. A scientist may receive the same award more than once in different years. All years in which a scientist received a particular award must be recorded. 23

24 ER to relational 24

25 ER to relational create table Chefs ( ssn char(9) primary key, name varchar(128), work_at_name varchar(128) not null, work_at_city varchar(128) not null, own_name varchar(128), own_city varchar(128), create table Restaurants ( name varchar(128), city varchar(128), primary key (name, city) foreign key (works_at_name, works_at_city) references Restaurants (name, city), foreign key (owns_name, owns_city) references Restaurants (name, city) 25

26 ER to relational 26

27 ER to relational create table Satellites_Orbit_Planets ( sat_name varchar(128) unique, sat_mass integer, panet_name varchar(128) primary key, planet_mass integer another option? 27

28 HW 2 Problem 1(a) create table A ( id integer primary key, name char(32) create table B ( id integer primary key, name char(32) create table C_rel ( id integer primary key, name char(32), a_id integer unique not null, b_id integer not null, foreign key (a_id) references A(id), foreign key (b_id) references B(id), 28

29 HW 2 Problem 1(b) create table A_rel1 ( id integer primary key, name char(32), b_id integer, foreign key (b_id) references B(id) create table B ( id integer primary key, name char(32) create table C_rel2 ( id integer primary key, name char(32), b_id integer not null, foreign key (b_id) references B(id), 29

30 HW 2 Problem 2(a) create table Foo ( X integer primary key, Y integer unique, Z integer not null, foreign key (Y) references Bar(Y) create table Bar ( Y integer primary key create table Baz ( X integer primary key, W integer not null, foreign key (X) references Foo(X) 30

31 HW 2 Problem 2(b) create table R ( rid integer primary key, create table T ( name varchar(64) not null tid integer primary key, ) val float, sid integer, create table S ( foreign key (sid) references S(sid) sid integer primary key, ) name varchar(64) not null, rid integer not null unique, foreign key (rid) references R(rid) ) 31

32 HW 3 Problem 3(a) name% isolympic% name% dob% play& SPORTS& ATHLETES& name% belong_to& TEAMS& create table Sports ( name varchar(64) primary key, isolympic boolean create table Teams ( name varchar(64) primary key create table Athletes ( name varchar(64), dob date, team varchar(64), sport varchar(64) not null, primary key (name, dob), foreign key (team) references Teams(name), foreign key (sport) references Sports(name) 32

33 HW 3 Problem 3(b) create table Galleries ( name varchar(128), city varchar(128), primary key (name, city) create table Display ( title varchar(128), author varchar(128), gname varchar(128, gcity varchar(128, primary key (title, author, gname, gcity), create table Paintings_Own ( foreign key (title, author) title varchar(128), references Paintings_Own (title, author), author varchar(128), foreign key (gname, gcity) gname varchar(128) not null, references Galleries (name, city) gcity varchar(128) not null, primary key (title, author), foreign key (gname, gcity) references Galleries (name, city) 33

34 HW 3 Problem 3(c) create table Airlines ( name varchar(32), country varchar(32), primary key (name, country) create table Flights ( num varchar(32) primary key, dept date, arr date, aname varchar(32), acountry varchar(32), foreign key (aname, acountry) references Airlines (name, country) create table Cities ( name varchar(32), country varchar(32), population integer, primary key (name, country) create table Connect ( flight_num varchar(32), orig_city varchar(32), orig_country varchar(32), dest_city varchar(32), dest_country varchar(32), primary key (flight_num, orig_city, orig_country, dest_city, dest_country), foreign key (fight_num) references Flights(num), foreign key (orig_city, orig_country) references Cities (name, country), foreign key (dest_city, dest_country) references Cities (name, country) 34

35 HW 3 Problem 3(d) name diameter mass Planets name Satellites orbit orbital_period create table Satellites ( name varchar(64), planet varchar(64), orbital_period integer, primary key (name, planet), foreign key (planet) references Planets(name) on delete cascade period orbit named after name brightness name mythology Stars metallicity Deities create table Deities ( name varchar(64), mythology varchar(64), primary key (name, mythology) create table Stars ( name varchar(64) primary key, brightness integer, metallicity integer create table Planets ( name varchar(64) primary key, diameter integer, mass integer, star varchar(64) not null, period integer, deity varchar(64), mythology varchar(64), foreign key (star) references Stars(name), foreign key (deity, mythology) references Deities (name, mythology) 35

Homework 2: Translating between the ER and relational models Due at 5pm on Wednesday, April 25

Homework 2: Translating between the ER and relational models Due at 5pm on Wednesday, April 25 CS 461, Databases Systems, Spring 2018 Description Homework 2: Translating between the ER and relational models Due at 5pm on Wednesday, April 25 This assignment covers translation between the two models

More information

Draw an ER diagram that encodes the following business rules. Clearly mark all key and participation constraints.

Draw an ER diagram that encodes the following business rules. Clearly mark all key and participation constraints. CS 500, Fundamentals of Databases Midterm Exam Completed between February 16 th (9am) and February 18 th (11pm), 2018 SOLUTIONS Problem 1 (20 points): ER modeling Draw an ER diagram that encodes the following

More information

CS 461: Database Systems. Final Review. Julia Stoyanovich

CS 461: Database Systems. Final Review. Julia Stoyanovich CS 461: Database Systems Final Review (stoyanovich@drexel.edu) Final exam logistics When: June 6, in class The same format as the midterm: open book, open notes 2 hours in length The exam is cumulative,

More information

Er Diagram Exercises. Exercise1. Draw an ER diagram for the following application from the manufacturing industry.

Er Diagram Exercises. Exercise1. Draw an ER diagram for the following application from the manufacturing industry. Er Diagram Exercises Exercise1 Draw an ER diagram for the following application from the manufacturing industry. 1. Each supplier has a unique name, and located in a city. 2. Each part has a unique number.

More information

Midterm Exam ANSWER KEY

Midterm Exam ANSWER KEY CS 461, Database Systems Midterm Exam ANSWER KEY Problem 1: Business rules to ER diagrams For each question below, draw an ER diagram that correctly represents the business rules. Assume that the only

More information

Er Diagram Exercises. Exercise1

Er Diagram Exercises. Exercise1 Er Diagram Exercises Exercise1 Exercise 2 You have just been hired as a consultant for a big airplane manufacturer. They want you to completely redesign their database system. Talking with the people in

More information

Midterm Exam #1 Version A CS 122A Winter 2017

Midterm Exam #1 Version A CS 122A Winter 2017 NAME: SEAT NO.: STUDENT ID: Midterm Exam #1 Version A CS 122A Winter 2017 Max. Points: 100 (Please read the instructions carefully) Instructions: - The total time for the exam is 50 minutes; be sure to

More information

Translating an ER Diagram to a Relational Schema

Translating an ER Diagram to a Relational Schema Translating an ER Diagram to a Relational Schema CS386/586 Introduction to Database Systems, Lois Delcambre 1999-2009 Slide 1 Translate each entity set into a table, with keys. Entity set: represented

More information

Midterm Exam #1 Version B CS 122A Winter 2017

Midterm Exam #1 Version B CS 122A Winter 2017 NAME: SEAT NO.: STUDENT ID: Midterm Exam #1 Version B CS 122A Winter 2017 Max. Points: 100 (Please read the instructions carefully) Instructions: - The total time for the exam is 50 minutes; be sure to

More information

The Relational Model Translating ER models to Relational Schemas

The Relational Model Translating ER models to Relational Schemas CS 500: Fundamentals of Databases The Relational Model Translating ER models to Relational Schemas supplementary material: Database Management Systems 3.1-3.5 class notes GoT.sql (stoyanovich@drexel.edu)

More information

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data. Managing Data Data storage tool must provide the following features: Data definition (data structuring) Data entry (to add new data) Data editing (to change existing data) Querying (a means of extracting

More information

High-Level Database Models (ii)

High-Level Database Models (ii) ICS 321 Spring 2011 High-Level Database Models (ii) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 1 Logical DB Design: ER to Relational Entity sets to

More information

ENTITY-RELATIONSHIP MODEL. CS 564- Spring 2018

ENTITY-RELATIONSHIP MODEL. CS 564- Spring 2018 ENTITY-RELATIONSHIP MODEL CS 564- Spring 2018 WHAT IS THIS LECTURE ABOUT E/R Model: entity sets, attribute relation: binary, multi-way relationship roles, attributes on relationships subclasses (ISA) weak

More information

High Level Database Models

High Level Database Models ICS 321 Fall 2011 High Level Database Models Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 9/21/2011 Lipyeow Lim -- University of Hawaii at Manoa 1 Database

More information

Announcements. Database Design. Database Design. Database Design Process. Entity / Relationship Diagrams. Introduction to Data Management CSE 344

Announcements. Database Design. Database Design. Database Design Process. Entity / Relationship Diagrams. Introduction to Data Management CSE 344 Announcements Introduction to Data Management CSE 344 HW5 due this Friday Please note minor up to the instructions WQ6 due next Wednesday Lecture 17: E/R Diagrams and Constraints 1 2 Database Design What

More information

CS 327E Lecture 11. Shirley Cohen. March 2, 2016

CS 327E Lecture 11. Shirley Cohen. March 2, 2016 CS 327E Lecture 11 Shirley Cohen March 2, 2016 Agenda Announcements Readings for today Reading Quiz Concept Questions Homework for next time Announcements Midterm 2 will be next Wednesday There will be

More information

SQL Data Definition and Data Manipulation Languages (DDL and DML)

SQL Data Definition and Data Manipulation Languages (DDL and DML) .. Cal Poly CPE/CSC 365: Introduction to Database Systems Alexander Dekhtyar.. SQL Data Definition and Data Manipulation Languages (DDL and DML) Note: This handout instroduces both the ANSI SQL synatax

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lecture 17: E/R Diagrams and Constraints CSE 344 - Winter 2016 1 Announcements HW5 due this Friday Please note minor update to the instructions WQ6 due next Wednesday

More information

Midterm Exam #1 (Version B) CS 122A Spring 2018

Midterm Exam #1 (Version B) CS 122A Spring 2018 https://orangecounty.craigslist.org/d/housing/search/hhhname: SEAT NO.: STUDENT ID: Midterm Exam #1 (Version B) CS 122A Spring 2018 Max. Points: 100 (Please read the instructions carefully) Instructions:

More information

CS145 Midterm Examination

CS145 Midterm Examination CS145 Midterm Examination Spring 2002, Prof. Widom Please read all instructions (including these) carefully. There are 9 problems on the exam, with a varying number of points for each problem and subproblem

More information

L12: ER modeling 5. CS3200 Database design (sp18 s2) 2/22/2018

L12: ER modeling 5. CS3200 Database design (sp18 s2)   2/22/2018 L12: ER modeling 5 CS3200 Database design (sp18 s2) https://course.ccs.neu.edu/cs3200sp18s2/ 2/22/2018 200 Announcements! Keep bringing your name plates J Exam 1 discussion: questions on grading: Piazza,

More information

CSC 261/461 Database Systems Lecture 10

CSC 261/461 Database Systems Lecture 10 CSC 261/461 Database Systems Lecture 10 Spring 2018 Please put away all electronic devices Announcements From now on, no electronic devices allowed during lecture Includes Phone and Laptop Why? For your

More information

Where Are We? Next Few Lectures. Integrity Constraints Motivation. Constraints in E/R Diagrams. Keys in E/R Diagrams

Where Are We? Next Few Lectures. Integrity Constraints Motivation. Constraints in E/R Diagrams. Keys in E/R Diagrams Where Are We? Introduction to Data Management CSE 344 Lecture 15: Constraints We know quite a bit about using a DBMS Start with real-world problem, design ER diagram From ER diagram to relations -> conceptual

More information

Advance Database Management System

Advance Database Management System Advance Database Management System Conceptual Design Lecture- A simplified database design process Database Requirements UoD Requirements Collection and Analysis Functional Requirements A simplified database

More information

2. E/R Design Considerations

2. E/R Design Considerations 2. E/R Design Considerations 32 What you will learn in this section Relationships cont d: multiplicity, multi-way Design considerations Conversion to SQL 33 Multiplicity of E/R Relationships Multiplicity

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lecture 15: E/R Diagrams Guest Lecturer: Sudeepa Roy CSE 344 - Fall 2013 1 Announcements WQ6 due Thursday (there is no WQ5 ) Homework 4 posted, due Friday Midterm:

More information

Database Design Process Entity / Relationship Diagrams

Database Design Process Entity / Relationship Diagrams Announcements Database Systems CSE 414 Lecture 22: E/R Diagrams (4.1-6) and Constraints (7.1-2) HW7 will be posted on Tuesday and due on Dec. 1 st 11pm WQ6 will be posted on Tuesday and due on Nov. 30th

More information

CS 134 Midterm Spring 2013

CS 134 Midterm Spring 2013 CS 134 Midterm Spring 2013 This is a closed book exam. You have 75 minutes to complete the exam. There are 5 questions on this examination. The point values for the questions are shown in the table below.

More information

Announcements. Database Design. Database Design. Database Design Process. Entity / Relationship Diagrams. Database Systems CSE 414

Announcements. Database Design. Database Design. Database Design Process. Entity / Relationship Diagrams. Database Systems CSE 414 Announcements Database Systems CSE 414 HW5 due on Thursday (was Tuesday before) WQ6 due on Sunday Lecture 17: E/R Diagrams (4.1-6) and Constraints (7.1-2) 1 2 Database Design What it is: Starting from

More information

CSE 344 JULY 30 TH DB DESIGN (CH 4)

CSE 344 JULY 30 TH DB DESIGN (CH 4) CSE 344 JULY 30 TH DB DESIGN (CH 4) ADMINISTRIVIA HW6 due next Thursday uses Spark API rather than MapReduce (a bit higher level) be sure to shut down your AWS cluster when not in use Still grading midterms...

More information

CS 186 Midterm, Spring 2003 Page 1

CS 186 Midterm, Spring 2003 Page 1 UNIVERSITY OF CALIFORNIA College of Engineering Department of EECS, Computer Science Division CS 186 Spring 2003 J. Hellerstein Midterm Midterm Exam: Introduction to Database Systems This exam has five

More information

CSE 344 MAY 14 TH ENTITIES

CSE 344 MAY 14 TH ENTITIES CSE 344 MAY 14 TH ENTITIES EXAMS Scores Final grades Concerned? Email about meeting Final Exam 35% of grade ADMINISTRIVIA HW6 Due Wednesday OQ6 Out Wednesday HW7 Out Wednesday E/R + Normalization DATABASE

More information

CS143: Relational Model

CS143: Relational Model CS143: Relational Model Book Chapters (4th) Chapters 1.3-5, 3.1, 4.11 (5th) Chapters 1.3-7, 2.1, 3.1-2, 4.1 (6th) Chapters 1.3-6, 2.105, 3.1-2, 4.5 Things to Learn Data model Relational model Database

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lecture 16: Constraints CSE 344 - Fall 2014 1 Announcements Sections tomorrow: XML. Quiz and next HW on XML posted soon, due next week after midterm HW 4 due tomorrow

More information

Conceptual Design. The Entity-Relationship (ER) Model

Conceptual Design. The Entity-Relationship (ER) Model Conceptual Design. The Entity-Relationship (ER) Model CS430/630 Lecture 12 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Database Design Overview Conceptual design The Entity-Relationship

More information

Surrogate Keys Ray Lockwood

Surrogate Keys Ray Lockwood Data Modeling and Implementation Surrogate Keys Pg 1 Surrogate Keys Ray Lockwood Points: A Surrogate Key is the primary key and links tables together. A Surrogate Key is usually a system generated integer.

More information

Database Systems CSE 414

Database Systems CSE 414 Database Systems CSE 414 Lecture 22: E/R Diagrams (4.1-6) and Constraints (7.1-2) CSE 414 - Fall 2017 1 Announcements HW7 will be posted on Tuesday and due on Dec. 1 st 11pm WQ6 will be posted on Tuesday

More information

PESIT Bangalore South Campus

PESIT Bangalore South Campus INTERNAL ASSESSMENT TEST I Date : 18/08/2015 Max Marks : 50 Subject & Code : Data Base Management System(10CS54) Section : 5 th Sem A & B Name of faculty : Ms.Rashma.B.M Time : 11:30am to 1:00pm Note:

More information

Entity-Relationship Modelling. Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables

Entity-Relationship Modelling. Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables Entity-Relationship Modelling Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables 1 Entity Sets A enterprise can be modeled as a collection of: entities, and

More information

Database Systems, CSCI Exam #2 Thursday November 4, 2010 at 2 pm

Database Systems, CSCI Exam #2 Thursday November 4, 2010 at 2 pm Database Systems, CSCI 4380-01 Exam #2 Thursday November 4, 2010 at 2 pm 1a (12) 1b (12) 1c (12) 1d (12) 2 (14) 3 (16) 4 (14) 5 (8) TOTAL Note. The exam is open book and open notes. Use your own book and

More information

Database Systems CSE 414

Database Systems CSE 414 Database Systems CSE 414 Lecture 17: E/R Diagrams (4.1-6) and Constraints (7.1-2) CSE 414 - Spring 2017 1 Announcements HW5 due on Thursday (was Tuesday before) WQ6 due on Sunday CSE 414 - Spring 2017

More information

FREEGAL MUSIC. Freegal Music offers access to nearly 3 million songs, including Sony Music s catalog of legendary artists.

FREEGAL MUSIC. Freegal Music offers access to nearly 3 million songs, including Sony Music s catalog of legendary artists. FREEGAL MUSIC Freegal Music offers access to nearly 3 million songs, including Sony Music s catalog of legendary artists. In total, the collection is comprised of music from over 10,000 labels with music

More information

IMPORTANT: Circle the last two letters of your class account:

IMPORTANT: Circle the last two letters of your class account: Fall 2004 University of California, Berkeley College of Engineering Computer Science Division EECS MIDTERM II CS 186 Introduction to Database Systems Prof. Michael J. Franklin NAME: D.B. Guru STUDENT ID:

More information

A the speed at which data can be downloaded. B the countries in which the phone can be used. C the data services the phone supports

A the speed at which data can be downloaded. B the countries in which the phone can be used. C the data services the phone supports Q1. The phones in Figure 1 use different network bands. The network band of a mobile phone limits: (1) A the speed at which data can be downloaded B the countries in which the phone can be used C the data

More information

Introduction to Data Management. Lecture #5 Relational Model (Cont.) & E-Rà Relational Mapping

Introduction to Data Management. Lecture #5 Relational Model (Cont.) & E-Rà Relational Mapping Introduction to Data Management Lecture #5 Relational Model (Cont.) & E-Rà Relational Mapping Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1

More information

The Entity-Relationship Model (ER Model) - Part 2

The Entity-Relationship Model (ER Model) - Part 2 Lecture 4 The Entity-Relationship Model (ER Model) - Part 2 By Michael Hahsler Based on slides for CS145 Introduction to Databases (Stanford) Lecture 4 > Section 2 What you will learn about in this section

More information

Introduction to Databases

Introduction to Databases Introduction to Databases Data Retrival SELECT * FROM Students S WHERE S.age < 18 Data Retrival SELECT S.name, S.login FROM Students S WHERE S.age < 18 Entity sets to tables Entity sets to tables CREATE

More information

Entity/Relationship Modelling

Entity/Relationship Modelling Entity/Relationship Modelling Lecture 4 1 Outline E/R model (Chapter 5) From E/R diagrams to relational schemas (Chapter 5) Constraints in SQL (Chapter 4) 2 1. Database Design Modelling Decide which part

More information

. : B.Sc. (H) Computer Science. Section A is compulsory. Attempt all parts together. Section A. Specialization lattice and Specialization hierarchy

. : B.Sc. (H) Computer Science. Section A is compulsory. Attempt all parts together. Section A. Specialization lattice and Specialization hierarchy ' This question paper contains 8 printed pages] Roll No. I I I I I I I I I I ( 1 S. No. of Question Paper : 6074 Unique Paper Code Name of the Paper Name of the Course Semester Duration : 3 Hours : 234305

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lecture 17: E/R Diagrams and Constraints CSE 344 - Fall 2015 1 Database Design Why do we need it? Need a way to model real world entities in terms of relations Not

More information

EGCI 321: Database Systems. Dr. Tanasanee Phienthrakul

EGCI 321: Database Systems. Dr. Tanasanee Phienthrakul 1 EGCI 321: Database Systems Dr. Tanasanee Phienthrakul 2 Chapter 10 Data Definition Language (DDL) 3 Basic SQL SQL language Considered one of the major reasons for the commercial success of relational

More information

Homework Assignment 3. November 11th, 2014 Due on November 25th, 12:30pm (noon) CS425 - Database Organization Results

Homework Assignment 3. November 11th, 2014 Due on November 25th, 12:30pm (noon) CS425 - Database Organization Results Name CWID Homework Assignment 3 November 11th, 2014 Due on November 25th, 12:30pm (noon) CS425 - Database Organization Results Please leave this empty! 3.1 3.2 Sum Instructions Try to answer all the questions

More information

CITS3240 Databases Mid-semester 2008

CITS3240 Databases Mid-semester 2008 CITS3240 Databases Mid-semester 2008 This paper consists of 6 pages and 3 questions. You should complete every question (total of 40 marks). Answer each question in the space provided. Name: Student Number:

More information

Handout 6 Logical design: Translating ER diagrams into SQL CREATE statements

Handout 6 Logical design: Translating ER diagrams into SQL CREATE statements 06-13584 Fundamentals of Databases Spring Semester 2005 The University of Birmingham School of Computer Science Achim Jung February 16, 2005 Handout 6 Logical design: Translating ER diagrams into SQL CREATE

More information

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng.

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng. Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng. Ahmed Abumarasa Database Lab Lab 2 Database Table Introduction: The previous

More information

Midterm Exam (Version B) CS 122A Spring 2017

Midterm Exam (Version B) CS 122A Spring 2017 NAME: SOLUTION SEAT NO.: STUDENT ID: Midterm Exam (Version B) CS 122A Spring 2017 Max. Points: 100 (Please read the instructions carefully) Instructions: - The total time for the exam is 80 minutes; be

More information

2.9 Table Creation. CREATE TABLE TableName ( AttrName AttrType, AttrName AttrType,... )

2.9 Table Creation. CREATE TABLE TableName ( AttrName AttrType, AttrName AttrType,... ) 2.9 Table Creation CREATE TABLE TableName ( AttrName AttrType, AttrName AttrType,... ) CREATE TABLE Addresses ( id INTEGER, name VARCHAR(20), zipcode CHAR(5), city VARCHAR(20), dob DATE ) A list of valid

More information

Jason Mraz - We Sing. We Dance. We Steal Things. By Jason Mraz

Jason Mraz - We Sing. We Dance. We Steal Things. By Jason Mraz Jason Mraz - We Sing. We Dance. We Steal Things. By Jason Mraz If looking for the book by Jason Mraz Jason Mraz - We Sing. We Dance. We Steal Things. in pdf format, then you've come to the loyal website.

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lecture 16: Constraints CSE 344 - Winter 2014 1 Announcements WQ5 due tonight deadline extended only for this WQ HW4 due tomorrow HW 5 posted, due next Thursday

More information

CSE 530 Midterm Exam

CSE 530 Midterm Exam CSE 530 Midterm Exam Name: (Print CLEARLY) Question Points Possible Points Earned 1 25 2 10 3 20 4 20 5 15 Total 90 1 Question 1 Heap Files Suppose we want to create a heap file with a page size of 512

More information

CIS 330: Applied Database Systems. ER to Relational Relational Algebra

CIS 330: Applied Database Systems. ER to Relational Relational Algebra CIS 330: Applied Database Systems ER to Relational Relational Algebra 1 Logical DB Design: ER to Relational Entity sets to tables: ssn name Employees lot CREATE TABLE Employees (ssn CHAR(11), name CHAR(20),

More information

CS 327E Lecture 10. Shirley Cohen. February 29, 2016

CS 327E Lecture 10. Shirley Cohen. February 29, 2016 CS 327E Lecture 10 Shirley Cohen February 29, 2016 Agenda Announcements Readings for today Reading Quiz Concept Questions Homework for next time Announcements Midterm exams will be returned at the end

More information

Conceptual Design with ER Model

Conceptual Design with ER Model Conceptual Design with ER Model Lecture #2 1/24/2012 Jeff Ballard CS564, Spring 2014, Database Management Systems 1 See the Moodle page Due February 7 Groups of 2-3 people Pick a team name Homework 1 is

More information

CS 134 Midterm Solutions Spring 2013

CS 134 Midterm Solutions Spring 2013 CS 134 Midterm Solutions Spring 2013 This is a closed book exam. You have 75 minutes to complete the exam. There are 5 questions on this examination. The point values for the questions are shown in the

More information

A Deeper Look at Data Modeling. Shan-Hung Wu & DataLab CS, NTHU

A Deeper Look at Data Modeling. Shan-Hung Wu & DataLab CS, NTHU A Deeper Look at Data Modeling Shan-Hung Wu & DataLab CS, NTHU Outline More about ER & Relational Models Weak Entities Inheritance Avoiding redundancy & inconsistency Functional Dependencies Normal Forms

More information

Databases and Transaction Processing: An Application-Oriented Approach (Complete Version) Test Bank: Additional Problems and Solutions

Databases and Transaction Processing: An Application-Oriented Approach (Complete Version) Test Bank: Additional Problems and Solutions Databases and Transaction Processing: An Application-Oriented Approach (Complete Version Test Bank: Additional Problems and Solutions Michael Kifer, Arthur Bernstein, Philip M. Lewis 1 Contents Problems

More information

Database Design & Deployment

Database Design & Deployment ICS 321 Data Storage & Retrieval High Level Database Models Prof. Lipyeow Lim InformaCon & Computer Science Department University of Hawaii at Manoa Lipyeow Lim - - University of Hawaii at Manoa 1 Database

More information

Introduction to Database Systems CSE 414

Introduction to Database Systems CSE 414 Introduction to Database Systems CSE 414 Lecture 17: E/R Diagrams CSE 414 - Spring 2013 1 Announcements HW5 (XML) due Wednesday New webquiz coming by mid-week Today: E/R diagrams (4.1-4.6) CSE 414 - Spring

More information

INFORMATION TECHNOLOGY: PAPER II. 1. This question paper consists of 9 pages. Please check that your question paper is complete.

INFORMATION TECHNOLOGY: PAPER II. 1. This question paper consists of 9 pages. Please check that your question paper is complete. NATIONAL SENIOR CERTIFICATE EXAMINATION NOVEMBER 2011 INFORMATION TECHNOLOGY: PAPER II Time: 3 hours 120 marks PLEASE READ THE FOLLOWING INSTRUCTIONS CAREFULLY 1. This question paper consists of 9 pages.

More information

The Relational Model. Week 2

The Relational Model. Week 2 The Relational Model Week 2 1 Relations A relation is a more concrete construction, of something we have seen before, the ER diagram. name S.S.N students street city A relation is (just!) a table! We will

More information

In this Lecture. More SQL Data Definition. Deleting Tables. Creating Tables. ALTERing Columns. Changing Tables. More SQL

In this Lecture. More SQL Data Definition. Deleting Tables. Creating Tables. ALTERing Columns. Changing Tables. More SQL In this Lecture Database Systems Lecture 6 Natasha Alechina More SQL DROP TABLE ALTER TABLE INSERT, UPDATE, and DELETE Data dictionary Sequences For more information Connolly and Begg chapters 5 and 6

More information

How to... make the most of your smartphone during the Summer of Sport

How to... make the most of your smartphone during the Summer of Sport How to... make the most of your smartphone during the Summer of Sport In partnership with The BBC s Olympic websites have all the latest news, events schedules, results, and the background to the Olympic

More information

Introducing Databases

Introducing Databases 12 Introducing Databases WHAT YOU WILL LEARN IN THIS CHAPTER: What a database is and which databases are typically used with ASP.NET pages What SQL is, how it looks, and how you use it to manipulate data

More information

Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa

Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa ICS 321 Spring 2011 Constraints, Triggers, Views & Indexes Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 04/04/2011 Lipyeow Lim -- University of Hawaii

More information

Integrity constraints, relationships. CS634 Lecture 2

Integrity constraints, relationships. CS634 Lecture 2 Integrity constraints, relationships CS634 Lecture 2 Foreign Keys Defined in Sec. 3.2.2 without mentioning nulls. Nulls covered in Sec. 5.6 First example: nice not-null foreign key column: create table

More information

CS2300: File Structures and Introduction to Database Systems

CS2300: File Structures and Introduction to Database Systems CS2300: File Structures and Introduction to Database Systems Lecture 14: SQL Doug McGeehan From Theory to Practice The Entity-Relationship Model: a convenient way of representing the world. The Relational

More information

Name: Database Systems ( 資料庫系統 ) Midterm exam, November 15, 2006

Name: Database Systems ( 資料庫系統 ) Midterm exam, November 15, 2006 1 of 8 pages Database Systems ( 資料庫系統 ) Midterm exam, November 15, 2006 Time: 10:00 ~ 12:20 Name: Student ID: I herewith state that I understand and will adhere to the following academic integrity: I will

More information

C a; C b; C e; int c;

C a; C b; C e; int c; CS1130 section 3, Spring 2012: About the Test 1 Purpose of test The purpose of this test is to check your knowledge of OO as implemented in Java. There is nothing innovative, no deep problem solving, no

More information

The University Of New South Wales. Final Exam November 2006 COMP9311. Database Systems

The University Of New South Wales. Final Exam November 2006 COMP9311. Database Systems Name: Student#: Signature: The University Of New South Wales Final Exam November 2006 COMP9311 Database Systems (1) Time allowed: 3 hours (2) Total number of marks: 110 (3) Total number of questions: 8

More information

CSC 261/461 Database Systems Lecture 8. Spring 2018

CSC 261/461 Database Systems Lecture 8. Spring 2018 CSC 261/461 Database Systems Lecture 8 Spring 2018 Announcement Quiz No New Problem Set Study Chapter 5, 6, and 7 Go through the problem set Announcement Project 2 Part 1 Already out. Workshop covered

More information

Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Today's Party. Example Database. Faloutsos/Pavlo CMU /615

Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Today's Party. Example Database. Faloutsos/Pavlo CMU /615 Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB Applications C. Faloutsos A. Pavlo Lecture#6: Fun with SQL (part2) Today's Party DDLs Complex Joins Views Nested Subqueries Triggers Database

More information

CS275 Intro to Databases

CS275 Intro to Databases CS275 Intro to Databases The Relational Data Model Chap. 3 How Is Data Retrieved and Manipulated? Queries Data manipulation language (DML) Retrieval Add Delete Update An Example UNIVERSITY database Information

More information

Conceptual Design. The Entity-Relationship (ER) Model

Conceptual Design. The Entity-Relationship (ER) Model Conceptual Design. The Entity-Relationship (ER) Model CS430/630 Lecture 12 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Relationship Set Representation ssn name lot since

More information

Introduction to Data Management. Lecture #5 (E-R Relational, Cont.)

Introduction to Data Management. Lecture #5 (E-R Relational, Cont.) Introduction to Data Management Lecture #5 (E-R Relational, Cont.) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW#1 is due

More information

The Entity-Relationship (ER) Model

The Entity-Relationship (ER) Model The Entity-Relationship (ER) Model Week 1-2 Professor Jessica Lin The E-R Model 2 The E-R Model The Entity-Relationship Model The E-R (entity-relationship) data model views the real world as a set of basic

More information

From theory to practice. Designing Tables for an Oracle Database System. Sqlplus. Sqlplus. Technicalities. Add the following to your.

From theory to practice. Designing Tables for an Oracle Database System. Sqlplus. Sqlplus. Technicalities. Add the following to your. From theory to practice Designing Tables for an Oracle Database System The Entity-Relationship model: a convenient way of representing the world. The Relational model: a model for organizing data using

More information

ANY INTERNET azcu2.atsusers.com The system works best with Internet Explorer or Firefox. azcu2.atsusers.com DO NOT azcu2.atsusers.

ANY INTERNET azcu2.atsusers.com The system works best with Internet Explorer or Firefox. azcu2.atsusers.com DO NOT azcu2.atsusers. I. Introduction a. This system is what we use at ACU to collect and secure important medical and emergency contact information on our student-athletes. We utilize this system to keep track of emergency

More information

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530 Translation of ER-diagram into Relational Schema Dr. Sunnie S. Chung CIS430/530 Learning Objectives Define each of the following database terms Relation Primary key Foreign key Referential integrity Field

More information

MySQL Workshop. Scott D. Anderson

MySQL Workshop. Scott D. Anderson MySQL Workshop Scott D. Anderson Workshop Plan Part 1: Simple Queries Part 2: Creating a database: creating a table inserting, updating and deleting data handling NULL values datatypes Part 3: Joining

More information

Assignment 1: Entity-Relationship Model Solution

Assignment 1: Entity-Relationship Model Solution Data odelling and Databases Exercise dates: arch /arch 2, 208 Ce Zhang, Gustavo Alonso Last update: arch 08, 208 Spring Semester 208 Head TA: Ingo üller Assignment : Entity-Relationship odel Solution This

More information

Prelim 1. CS 2110, 13 March 2018, 7:30 PM Total Question Name Short answer

Prelim 1. CS 2110, 13 March 2018, 7:30 PM Total Question Name Short answer Prelim 1 CS 2110, 13 March 2018, 7:30 PM 1 2 3 4 5 6 Total Question Name Short answer Exception handling Recursion OO Loop invariants Max 1 30 11 14 30 14 100 Score Grader The exam is closed book and closed

More information

Introduction to Data Management. Lecture #4 (E-R à Relational Design)

Introduction to Data Management. Lecture #4 (E-R à Relational Design) Introduction to Data Management Lecture #4 (E-R à Relational Design) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v Reminders:

More information

TECHNOEzine. Student Workbook

TECHNOEzine. Student Workbook TECHNOEzine For Microsoft Word 2010 Student Workbook TECHNOeBooks Project-based Computer Curriculum ebooks www.bepublishing.com Copyright 1993 2010. TechnoKids Inc. in partnership with B.E. Publishing,

More information

RELATIONAL ALGEBRA. CS 564- Fall ACKs: Dan Suciu, Jignesh Patel, AnHai Doan

RELATIONAL ALGEBRA. CS 564- Fall ACKs: Dan Suciu, Jignesh Patel, AnHai Doan RELATIONAL ALGEBRA CS 564- Fall 2016 ACKs: Dan Suciu, Jignesh Patel, AnHai Doan RELATIONAL QUERY LANGUAGES allow the manipulation and retrieval of data from a database two types of query languages: Declarative:

More information

Assignment 3 Translation from ER to Relational & Table Creation By Alexander Joel Heriford

Assignment 3 Translation from ER to Relational & Table Creation By Alexander Joel Heriford Assignment 3 Translation from ER to Relational & Table Creation By Alexander Joel Heriford MIS 331 Professor Faiz Currim 1. Tables regarding the employee Part A: Assignment 3 Preferred Database Schema

More information

Lecture 3. Wednesday, September 3, 2014

Lecture 3. Wednesday, September 3, 2014 Lecture 3 Wednesday, September 3, 2014 ER Diagrams Last week, we covered ER diagrams which allow us to show entities, attributes, and relationships The last component of an ER diagram is the cardinality

More information

SQL: Part II. Introduction to Databases CompSci 316 Fall 2018

SQL: Part II. Introduction to Databases CompSci 316 Fall 2018 SQL: Part II Introduction to Databases CompSci 316 Fall 2018 2 Announcements (Thu., Sep. 20) Homework #1 sample solution to be posted on Sakai by this weekend Homework #2 due in 1½ weeks Get started on

More information

CS 101 Fall 2006 Midterm 1 Name: ID:

CS 101 Fall 2006 Midterm 1 Name:  ID: You only need to write your name and e-mail ID on the first page. This exam is CLOSED text book, closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts, so be sure

More information

Officials Pay App User Guide

Officials Pay App User Guide Officials Pay App User Guide 1 Table of Contents 1. Register as a New User...3 2. CURRENT Vendor with FBISD 6 3. NEW Vendor to FBISD 9 4. Signing up for Games Worked....12 5. Reviewing Pay Requests Status.19

More information

MIE253S Midterm Exam

MIE253S Midterm Exam Mechanical and Industrial Engineering University of Toronto MIE253S Midterm Exam February 25 th 2016 Instructor: Mariano Consens DO NOT OPEN THIS BOOKLET UNTIL INSTRUCTED TO DO SO This is a closed book,

More information