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

Size: px
Start display at page:

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

Transcription

1 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 not use or attempt to use any unauthorized assistance, material, or study aids in this midterm examination. If I violate academic integrity, I may receive a grade of 0. Signature (5 points) Questions Max Points Points Signature Total 100

2 2 of 8 pages Question 1: (7 points) Drugwarehouse.com has offered you a free life-time supply of prescription drugs (no questions asked) if you design its database schema. Given the rising cost of health care, you agree. Here is the information that you gathered: Patients are identified by their SSN, and we also store their names and age. Doctors are identified by their SSN, and we also store their names and specialty. Each patient has one family doctor, and we want to know since when the patient has been with her family doctor. Each doctor has at least one patient. Draw an ER diagram that captures the above information: Choice 1: Choice 2: Question 2: (4 points) Consider the following E/R diagram. Suppose the key of entity set A is attribute A, the key of B is B, the key of C is C, and the key of D is D. If we translate relationship set R into a relation R(A,B,C,D), what are all the keys of R? (A) {A} (B) {B}, {C}, and {D} (C) {B,C,D} (D) {A,B,C}, {A,B,D}, and {A,C,D} Answer: B

3 3 of 8 pages Question 3: (12 points) Consider the following ER schema for the MOVIES database. Assume that MOVIES is a populated database. Actor is used as a generic term and includes actresses. Given the constraints shown in the ER schema, respond to the following statements by circling True, False, or Maybe. Circle the response of Maybe to statements that, while not explicitly shown to be True, cannot be proven False based on the schema as shown. a. There are no actors in this database that have been in no movies. ( True / False / Maybe ) b. There are some actors who have acted in more than ten movies. ( True / False / Maybe ) c. Some actors have done a lead role in multiple movies. ( True / False / Maybe ) d. A movie can have only a maximum of one lead actor. ( True / False / Maybe ) e. Every director has been an actor in some movie. ( True / False / Maybe ) f. No producer has ever been an actor. ( True / False / Maybe ) g. A producer cannot be an actor in some other movie. ( True / False / Maybe ) h. There are movies with more than a dozen actors. ( True / False / Maybe ) i. Some producers have been a director as well. ( True / False / Maybe ) j. Most movies have one director and one producer. ( True / False / Maybe ) k. Some movies have one director but several producers. ( True / False / Maybe ) l. No movie has a director that also acted in that movie. ( True / False / Maybe )

4 4 of 8 pages Questions 4 and 5 below refer to the following E/R design for a database that keeps track of buildings, rooms, and in particular, conference rooms. Question 4: (12 points) Convert the above E/R diagram into relations using CREATE TABLE command. CREATE TABLE Buildings { name CHAR(20), year INTEGER, PRIMARY KEY (name) } CREATE TABLE Rooms_in ( area CHAR(20), number INTEGER, name CHAR(20) NOT NULL, PRIMARY KEY (number, name), FOREIGN KEY (name) REFERENCES Buildings ON DELETE CASCADE, ) CREATE TABLE ConferenceRooms { capacity INTEGER, number INTEGER, name CHAR(20), PRIMARY KEY (number, name), FOREIGN KEY (number) REFERENCES Rooms_in, FOREIGN KEY (name) REFERENCES Buildings, } Question 5: (6 points) Which of the following statements are true according to the constraints encoded by the E/R diagram above? Do not make any assumptions other than those encoded by the E/R diagram. I. The number of entities in the Rooms entity set must be greater than or equal to the number of entities in the ConferenceRooms entity set II. The number of entities in the Rooms entity set must be greater than or equal to the number of entities in the Buildings entity set (A) I only (B) II only (C) Both I and II (D) Neither I nor II Answer: A If there is incorrect statement(s), provide a short explanation (e.g., a counter example) the incorrect one(s). (II) is incorrect because there may be buildings with no rooms (there is no constraint stating that a Building must have a room).

5 5 of 8 pages Question 6: (4 points) Suppose that two relations R(A,B) and S(A,B) have exactly the same schema. Which of the following equalities hold in relational algebra? I. R S = R (R S) II. R S = S (S R) III. R S = R S // is natural join (A) I only (B) I and II only (C) I, II, and III (D) None of the above Answer: C If there is incorrect equality(s), provide a short explanation (e.g., a counter example) for the incorrect one(s). None Question 7: (4 points) Suppose we have two relations R(A, B) and S(A, B) with the same schema. The only key of R is {A}; the only key of S is {A} as well. Let relation T(A,B) be the set union of R and S, i.e., T = R S. What are the keys of T? (A) {A} (B) {B} (C) {A} and {B} (D) {A,B} Answer: D Questions 8 and 9 below refer to the following database schema: Person(SSN, employersymbol, salary) Holding(SSN, symbol, numshares) A person is uniquely identified by a social security number (SSN). A company is uniquely identified by its stock ticker symbol. Each person is employed by exactly one company, but may hold any number of different stocks. Question 8: (6 points) Suppose we wish to find the SSN s of the persons who do not own stocks of their employers. Which of the following queries will return the correct set of SSN s? I. π SSN (σ employersymbol symbol (Person Holding)) II. π SSN (π SSN,sym (ρ P(SSN,sym,sal) (Person)) π SSN,sym (ρ H(SSN,sym,num) (Holding))) III. SELECT SSN FROM Person WHERE employersymbol <> ALL (SELECT symbol FROM Holding WHERE Person.SSN = Holding.SSN); (A) II only (B) I and II only (C) I and III only (D) II and III only If there is incorrect query(s), provide a short explanation (e.g., a counter example) for the incorrect one(s). Answer: D (I) is incorrect. If someone works for MSFT but owns both MSFT and YHOO stocks, his/her

6 6 of 8 pages name will be returned. Question 9: (6 points) Suppose we wish to find the average salary of the persons who own more than 100 shares of Microsoft (MSFT) or more than 100 shares of Yahoo! (YHOO). Which of the following queries will correctly compute the desired average? I. SELECT AVG(salary) FROM Person WHERE SSN IN (SELECT SSN FROM Holding WHERE (symbol = MSFT OR symbol = YHOO ) AND numshares > 100); II. SELECT AVG(salary) FROM Person, Holding WHERE Person.SSN = Holding.SSN AND ((symbol = MSFT AND numshares > 100) OR (symbol = YHOO AND numshares > 100)); (A) I only (B) II only (C) Both I and II (D) Neither I nor II Answer: A If there is incorrect query(s), provide a short explanation (e.g., a counter example) for the incorrect one(s). (II) is incorrect. Suppose John owns 200 shares of MSFT and 200 shares of YHOO, we end up with 2 tuples of John; therefore John s salaries will be counted twice in the average. Questions below refer to the following database schema: Person(SSN, employersymbol, salary) Holding(SSN, symbol, numshares) StockPrice(symbol, date, price) Person and Holding relations are identical to the ones used by Questions 8 and 9. We have added a third relation StockPrice, which tracks the closing price (per share) of each stock on each trading day. Question 10: (6 points) Write a relational algebra query to find the SSN s of all Microsft (MSFT) employees who own more than 50 shares of Oracle (ORCL) stock. Π SSN (σ employersymbol= MSFT (Person) σ symbol= ORCL AND numshares>50 (Holding)) Question 11: (6 points) Write a SQL query to find the total number of shares of Oracle (ORCL) stock owned by Microsoft (MSFT) employees. SELECT SUM(numShares) FROM Person, Holding WHERE employersymbol = MSFT AND Person.SSN = Holding.SSN AND symbol = ORCL

7 7 of 8 pages Question 12: (6 points) Write a relational algebra query to find the ticker symbols of all superstocks. A superstock is a stock whose closing price always rises on every trading day. You may compare date values using =, >, etc. (Hint: you do not need arithmetics on date values.) Π symbol (StockPrice) Π symbol (σ s1.symbol=s2.symbol AND s1.price >= s2.price AND s1.date < s2.date (ρ s1 (StockPrice) x ρ s2 (StockPrice)) Question 13: (10 points) Let us define a widely-held stock to be one that is owned by more than 40% of the investors in our database. Write a SQL query to find the latest closing price for each widely-held stock. Note that some quotes may be delayed: for example, the latest closing price of Microsoft stored in our database might be one day old, while the latest closing price of Macrohard might be two days old. SELECT symbol, price FROM StockPrice S WHERE symbol IN (SELECT symbol FROM Holding GROUP BY symbol HAVING COUNT(*)>(SELECT 0.4*COUNT(DISTINCT SSN) FROM Holding)) AND date >= ALL (SELECT date FROM StockPrice WHERE symbol = s.symbol);

8 8 of 8 pages Question 14 (6 points) Consider a relation Took(name, class, quarter) whose tuples record that a student took a given class in a given quarter. You may assume that no two students have the same name, and there is no key for this relation except all three attributes together. Write a SQL query to find all pairs of students who have never taken a class together i.e., have never taken the same class in the same quarter. Make sure to return each pair of students only once. (For example, if your expression returns <Mary,Fred> then it should not also return <Fred, Mary> or any additional copies of <Mary,Fred>.) You may compare name values using =, >, etc. Your expression will be graded on simplicity as well as correctness. SELECT DISTINCT (T1.name), T2.name FROM Took AS T1, Took AS T2 WHERE T1.name > T2.name EXCEPT SELECT T3.name, T4.name FROM Took T3, Took T4 WHERE T3.class=T4.class AND T3.quarter = T4.quarter AND T3.name > T4.name

Task: Design an ER diagram for that problem. Specify key attributes of each entity type.

Task: Design an ER diagram for that problem. Specify key attributes of each entity type. Q1. Consider the following set of requirements for a university database that is used to keep track of students transcripts. (10 marks) 1. The university keeps track of each student s name, student number,

More information

CSE 444, Winter 2011, Midterm Examination 9 February 2011

CSE 444, Winter 2011, Midterm Examination 9 February 2011 Name: CSE 444, Winter 2011, Midterm Examination 9 February 2011 Rules: Open books and open notes. No laptops or other mobile devices. Please write clearly. Relax! You are here to learn. An extra page is

More information

Examination examples

Examination examples Examination examples Databasteknik (5 hours) 1. Relational Algebra & SQL (4 pts total; 2 pts each). Part A Consider the relations R(A, B), and S(C, D). Of the following three equivalences between expressions

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 Database Design - Assignments #3 Due on 30 March 2015 (Monday)

CS Database Design - Assignments #3 Due on 30 March 2015 (Monday) CS422 - Database Design - Assignments #3 Due on 30 March 205 (Monday) The solutions must be hand written, no computer printout, and no photocopy.. (From CJ Date s book 4th edition, page 536) Figure represents

More information

CS348: INTRODUCTION TO DATABASE MANAGEMENT (Winter, 2011) FINAL EXAMINATION

CS348: INTRODUCTION TO DATABASE MANAGEMENT (Winter, 2011) FINAL EXAMINATION CS348: INTRODUCTION TO DATABASE MANAGEMENT (Winter, 2011) FINAL EXAMINATION INSTRUCTOR: Grant Weddell TIME: 150 minutes WRITE YOUR NAME AND ID HERE: NOTE 1: This is a closed book examination. For example,

More information

CSE-3421M Test #2. Queries

CSE-3421M Test #2. Queries 14 March 2013 CSE-3421M Test #2 w/ answers p. 1 of 16 CSE-3421M Test #2 Queries Family Name: Given Name: Student#: CS&E Account: Instructor: Parke Godfrey Exam Duration: 75 minutes Term: Winter 2013 Answer

More information

1 (10) 2 (8) 3 (12) 4 (14) 5 (6) Total (50)

1 (10) 2 (8) 3 (12) 4 (14) 5 (6) Total (50) Student number: Signature: UNIVERSITY OF VICTORIA Faculty of Engineering Department of Computer Science CSC 370 (Database Systems) Instructor: Daniel M. German Midterm Oct 21, 2004 Duration: 60 minutes

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science Midterm Test CSC 343H1F, 2016 Section L0101/L2001 (Horton) Duration 50 minutes No aids allowed PLEASE HAND IN Student Number: Last Name:

More information

The University of British Columbia

The University of British Columbia The University of British Columbia Computer Science 304 Midterm Examination January 30, 2012 Time: 50 minutes Total marks: 40 Instructor: Rachel Pottinger ANSWER KEY (PRINT) (Last) (First) Signature This

More information

CS411 Database Systems. 05: Relational Schema Design Ch , except and

CS411 Database Systems. 05: Relational Schema Design Ch , except and CS411 Database Systems 05: Relational Schema Design Ch. 3.1-3.5, except 3.4.2-3.4.3 and 3.5.3. 1 How does this fit in? ER Diagrams: Data Definition Translation to Relational Schema: Data Definition Relational

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science DECEMBER 2011 EXAMINATIONS CSC 343 H1F Instructors: Horton and Papangelis Duration 3 hours PLEASE HAND IN Examination Aids: None Student

More information

Entity-Relationship Model. From Chapter 5, Kroenke book

Entity-Relationship Model. From Chapter 5, Kroenke book Entity-Relationship Model From Chapter 5, Kroenke book Database Design Process Requirements analysis Conceptual design data model Logical design Schema refinement: Normalization Physical tuning Problem:

More information

Relational model continued. Understanding how to use the relational model. Summary of board example: with Copies as weak entity

Relational model continued. Understanding how to use the relational model. Summary of board example: with Copies as weak entity COS 597A: Principles of Database and Information Systems Relational model continued Understanding how to use the relational model 1 with as weak entity folded into folded into branches: (br_, librarian,

More information

CS 245 Midterm Exam Winter 2014

CS 245 Midterm Exam Winter 2014 CS 245 Midterm Exam Winter 2014 This exam is open book and notes. You can use a calculator and your laptop to access course notes and videos (but not to communicate with other people). You have 70 minutes

More information

Final Examination Computer Science 420 Dr. St. John Lehman College City University of New York 21 May 2002

Final Examination Computer Science 420 Dr. St. John Lehman College City University of New York 21 May 2002 Final Examination Computer Science 420 Dr. St. John Lehman College City University of New York 21 May 2002 NAME (Printed) NAME (Signed) E-mail Exam Rules Show all your work. Your grade will be based on

More information

Computer Science 597A Fall 2008 First Take-home Exam Out: 4:20PM Monday November 10, 2008 Due: 3:00PM SHARP Wednesday, November 12, 2008

Computer Science 597A Fall 2008 First Take-home Exam Out: 4:20PM Monday November 10, 2008 Due: 3:00PM SHARP Wednesday, November 12, 2008 Computer Science 597A Fall 2008 First Take-home Exam Out: 4:20PM Monday November 10, 2008 Due: 3:00PM SHARP Wednesday, November 12, 2008 Instructions: This exam must be entirely your own work. Do not consult

More information

CS145 Midterm Examination

CS145 Midterm Examination CS145 Midterm Examination Spring 2004, 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

Answer 2.3 The ER diagram is shown in Figure 2.1.

Answer 2.3 The ER diagram is shown in Figure 2.1. 10 Chapter 2 Answer 2.3 The ER diagram is shown in Figure 2.1. Exercise 2.4 A company database needs to store information about employees (identified by ssn, withsalary and phone as attributes), departments

More information

Relational Model, Relational Algebra, and SQL

Relational Model, Relational Algebra, and SQL Relational Model, Relational Algebra, and SQL August 29, 2007 1 Relational Model Data model. constraints. Set of conceptual tools for describing of data, data semantics, data relationships, and data integrity

More information

[18 marks] Consider the following schema for tracking customers ratings of books for a bookstore website.

[18 marks] Consider the following schema for tracking customers ratings of books for a bookstore website. Question 1. [18 marks] Consider the following schema for tracking customers ratings of books for a bookstore website. Books(ISBN, title, author, year, length). ISBN is a string used internationally for

More information

Introduction to Databases

Introduction to Databases Introduction to Databases IT University of Copenhagen January 16, 2006 This exam consists of 5 problems with a total of 16 questions. The weight of each problem is stated. You have 4 hours to answer all

More information

4/10/2018. Relational Algebra (RA) 1. Selection (σ) 2. Projection (Π) Note that RA Operators are Compositional! 3.

4/10/2018. Relational Algebra (RA) 1. Selection (σ) 2. Projection (Π) Note that RA Operators are Compositional! 3. Lecture 33: The Relational Model 2 Professor Xiannong Meng Spring 2018 Lecture and activity contents are based on what Prof Chris Ré of Stanford used in his CS 145 in the fall 2016 term with permission

More information

Database Management Systems Paper Solution

Database Management Systems Paper Solution Database Management Systems Paper Solution Following questions have been asked in GATE CS exam. 1. Given the relations employee (name, salary, deptno) and department (deptno, deptname, address) Which of

More information

The exam is open book; any written materials may be used, as well as on-line or

The exam is open book; any written materials may be used, as well as on-line or CS145 Midterm Examination Thursday, November 4, 2004, 2:45 í 4PM Directions The exam is open book; any written materials may be used, as well as on-line or electronically stored materials. However, it

More information

CS 245 Midterm Exam Solution Winter 2015

CS 245 Midterm Exam Solution Winter 2015 CS 245 Midterm Exam Solution Winter 2015 This exam is open book and notes. You can use a calculator and your laptop to access course notes and videos (but not to communicate with other people). You have

More information

EECS-3421a: Test #2 Queries

EECS-3421a: Test #2 Queries 2016 November 9 EECS-3421a: Test #2 w/ answers 1 of 16 EECS-3421a: Test #2 Queries Electrical Engineering & Computer Science Lassonde School of Engineering York University Family Name: Given Name: Student#:

More information

CSE 344 Midterm. Wednesday, February 19, 2014, 14:30-15:20. Question Points Score Total: 100

CSE 344 Midterm. Wednesday, February 19, 2014, 14:30-15:20. Question Points Score Total: 100 CSE 344 Midterm Wednesday, February 19, 2014, 14:30-15:20 Name: Question Points Score 1 30 2 50 3 12 4 8 Total: 100 This exam is open book and open notes but NO laptops or other portable devices. You have

More information

THE UNIVERSITY OF BRITISH COLUMBIA CPSC 304: MIDTERM EXAMINATION SET A OCTOBER 2016

THE UNIVERSITY OF BRITISH COLUMBIA CPSC 304: MIDTERM EXAMINATION SET A OCTOBER 2016 THE UNIVERSITY OF BRITISH COLUMBIA CPSC 304: MIDTERM EXAMINATION SET A OCTOBER 2016 General Instructions 1. This is a closed book, closed notes exam. There are total 12 pages. Answer all questions in the

More information

CSE 344 Midterm. Wednesday, February 19, 2014, 14:30-15:20. Question Points Score Total: 100

CSE 344 Midterm. Wednesday, February 19, 2014, 14:30-15:20. Question Points Score Total: 100 CSE 344 Midterm Wednesday, February 19, 2014, 14:30-15:20 Name: Question Points Score 1 30 2 50 3 12 4 8 Total: 100 This exam is open book and open notes but NO laptops or other portable devices. You have

More information

Database Systems ( 資料庫系統 )

Database Systems ( 資料庫系統 ) Database Systems ( 資料庫系統 ) 9.28.2011 Lecture #3 1 Course Administration Please download HW #1 from course homepage It is due 10/12/2011. This lecture: R&G Chapter 3 Next week reading: R&G Chapter 41~ 4.1

More information

CMPS182 Midterm Examination. Name: Question 1: Question 2: Question 3: Question 4: Question 5: Question 6:

CMPS182 Midterm Examination. Name: Question 1: Question 2: Question 3: Question 4: Question 5: Question 6: CMPS182MidtermExamination Name: Question1: Question2: Question3: Question4: Question5: Question6: Name: 2/10 WarmUp ShortQuestions(10points) What is the difference between a view and a normal table? The

More information

Fundamentals of Database Systems

Fundamentals of Database Systems Fundamentals of Database Systems Assignment: 1 Due Date: 8th August, 2017 Instructions This question paper contains 15 questions in 5 pages. Q1: The users are allowed to access different parts of data

More information

Course No: 4411 Database Management Systems Fall 2008 Midterm exam

Course No: 4411 Database Management Systems Fall 2008 Midterm exam Course No: 4411 Database Management Systems Fall 2008 Midterm exam Last Name: First Name: Student ID: Exam is 80 minutes. Open books/notes The exam is out of 20 points. 1 1. (16 points) Multiple Choice

More information

CSE 444 Midterm Test

CSE 444 Midterm Test CSE 444 Midterm Test Spring 2007 Name: Total time: 50 Question 1 /40 Question 2 /30 Question 3 /30 Total /100 1 1 SQL [40 points] Consider a database of social groups that allows people to become members

More information

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science APRIL 2015 EXAMINATIONS CSC 343 H1S Instructor: Horton and Liu Duration 3 hours PLEASE HAND IN Examination Aids: None Student Number: Family

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

CMU - SCS / Database Applications Spring 2013, C. Faloutsos Homework 1: E.R. + Formal Q.L. Deadline: 1:30pm on Tuesday, 2/5/2013

CMU - SCS / Database Applications Spring 2013, C. Faloutsos Homework 1: E.R. + Formal Q.L. Deadline: 1:30pm on Tuesday, 2/5/2013 CMU - SCS 15-415/15-615 Database Applications Spring 2013, C. Faloutsos Homework 1: E.R. + Formal Q.L. Deadline: 1:30pm on Tuesday, 2/5/2013 Reminders - IMPORTANT: Like all homeworks, it has to be done

More information

Intermediate SQL ( )

Intermediate SQL ( ) CSL 451 Introduction to Database Systems Intermediate SQL (4.1-4.4) Department of Computer Science and Engineering Indian Institute of Technology Ropar Narayanan (CK) Chatapuram Krishnan! Summary Join

More information

The University of British Columbia

The University of British Columbia The University of British Columbia Computer Science 304 Midterm Examination February 23, 2005 Time: 50 minutes Total marks: 50 Instructor: George Tsiknis Name (PRINT) (Last) (First) Signature This examination

More information

The Relational Data Model

The Relational Data Model The Relational Data Model Lecture 6 1 Outline Relational Data Model Functional Dependencies Logical Schema Design Reading Chapter 8 2 1 The Relational Data Model Data Modeling Relational Schema Physical

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

UNIVERSITY OF CALIFORNIA College of Engineering Department of EECS, Computer Science Division

UNIVERSITY OF CALIFORNIA College of Engineering Department of EECS, Computer Science Division UNIVERSITY OF CALIFORNIA College of Engineering Department of EECS, Computer Science Division CS186 Eben Haber Fall 2003 Midterm Midterm Exam: Introduction to Database Systems This exam has seven problems,

More information

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization CSE 544 Principles of Database Management Systems Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization References R&G Book. Chapter 19: Schema refinement and normal forms Also relevant to

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

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 9: Relational Model & Relational Algebra Doug McGeehan 1 Brief Review Relational model concepts Informal Terms Formal Terms Table Relation

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

CS145 Final Examination

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

More information

Midterm 2: CS186, Spring 2015

Midterm 2: CS186, Spring 2015 Midterm 2: CS186, Spring 2015 Prof. J. Hellerstein You should receive a double-sided answer sheet and an 8-page exam. Mark your name and login on both sides of the answer sheet, and in the blanks above.

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

CS145 Final Examination

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

More information

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

IMPORTANT: Circle the last two letters of your class account: Fall 2002 University of California, Berkeley College of Engineering Computer Science Division EECS Prof. Michael J. Franklin MIDTERM AND SOLUTIONS CS 186 Introduction to Database Systems NAME: Norm L.

More information

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization CSE 544 Principles of Database Management Systems Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization References R&G Book. Chapter 19: Schema refinement and normal forms Also relevant to this

More information

Exam I Computer Science 420 Dr. St. John Lehman College City University of New York 12 March 2002

Exam I Computer Science 420 Dr. St. John Lehman College City University of New York 12 March 2002 Exam I Computer Science 420 Dr. St. John Lehman College City University of New York 12 March 2002 NAME (Printed) NAME (Signed) E-mail Exam Rules Show all your work. Your grade will be based on the work

More information

Database Management Systems

Database Management Systems Sample Questions 1 Write SQL query to create a table for describing a book. The table should have Book Title, Author, Publisher, Year published, and ISBN fields. Your table should have a primary key. For

More information

L22: The Relational Model (continued) CS3200 Database design (sp18 s2) 4/5/2018

L22: The Relational Model (continued) CS3200 Database design (sp18 s2)   4/5/2018 L22: The Relational Model (continued) CS3200 Database design (sp18 s2) https://course.ccs.neu.edu/cs3200sp18s2/ 4/5/2018 256 Announcements! Please pick up your exam if you have not yet HW6 will include

More information

Lecture 16. The Relational Model

Lecture 16. The Relational Model Lecture 16 The Relational Model Lecture 16 Today s Lecture 1. The Relational Model & Relational Algebra 2. Relational Algebra Pt. II [Optional: may skip] 2 Lecture 16 > Section 1 1. The Relational Model

More information

Mahathma Gandhi University

Mahathma Gandhi University Mahathma Gandhi University BSc Computer science III Semester BCS 303 OBJECTIVE TYPE QUESTIONS Choose the correct or best alternative in the following: Q.1 In the relational modes, cardinality is termed

More information

Basant Group of Institution

Basant Group of Institution Basant Group of Institution Visual Basic 6.0 Objective Question Q.1 In the relational modes, cardinality is termed as: (A) Number of tuples. (B) Number of attributes. (C) Number of tables. (D) Number of

More information

ITCS 3160 DATA BASE DESIGN AND IMPLEMENTATION

ITCS 3160 DATA BASE DESIGN AND IMPLEMENTATION ITCS 3160 DATA BASE DESIGN AND IMPLEMENTATION JING YANG 2010 FALL Class 3: The Relational Data Model and Relational Database Constraints Outline 2 The Relational Data Model and Relational Database Constraints

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

Score. 1 (10) 2 (10) 3 (8) 4 (13) 5 (9) Total (50)

Score. 1 (10) 2 (10) 3 (8) 4 (13) 5 (9) Total (50) Student number: Signature: UNIVERSITY OF VICTORIA Faculty of Engineering Department of Computer Science CSC 370 (Database Systems) Instructor: Daniel M. German Midterm 18 June 2003 Duration: 75 minutes

More information

Solutions. Updated of 7

Solutions. Updated of 7 CHALMERS UNIVERSITY OF TECHNOLOGY Department of Computer Science and Engineering Examination in Databases, TDA357/DIT620 Tuesday 17 December 2013, 14:00-18:00 Solutions Updated 2014-11-19 1 of 7 Question

More information

CSE 562 Database Systems

CSE 562 Database Systems Goal CSE 562 Database Systems Question: The relational model is great, but how do I go about designing my database schema? Database Design Some slides are based or modified from originals by Magdalena

More information

Relational Model. Topics. Relational Model. Why Study the Relational Model? Linda Wu (CMPT )

Relational Model. Topics. Relational Model. Why Study the Relational Model? Linda Wu (CMPT ) Topics Relational Model Linda Wu Relational model SQL language Integrity constraints ER to relational Views (CMPT 354 2004-2) Chapter 3 CMPT 354 2004-2 2 Why Study the Relational Model? Most widely used

More information

The SQL data-definition language (DDL) allows defining :

The SQL data-definition language (DDL) allows defining : Introduction to SQL Introduction to SQL Overview of the SQL Query Language Data Definition Basic Query Structure Additional Basic Operations Set Operations Null Values Aggregate Functions Nested Subqueries

More information

Introduction to Data Management CSE 344. Lectures 8: Relational Algebra

Introduction to Data Management CSE 344. Lectures 8: Relational Algebra Introduction to Data Management CSE 344 Lectures 8: Relational Algebra CSE 344 - Winter 2016 1 Announcements Homework 3 is posted Microsoft Azure Cloud services! Use the promotion code you received Due

More information

CSE-3421 Test #1 Design

CSE-3421 Test #1 Design 2 April 2009 CSE-3421 Test #1 (corrected) w/ answers p. 1 of 10 CSE-3421 Test #1 Design Family Name: Given Name: Student#: CS Account: Instructor: Parke Godfrey Exam Duration: 75 minutes Term: winter 2009

More information

The University of British Columbia

The University of British Columbia The University of British Columbia Computer Science 304 Midterm Examination February 8, 2010 Time: 50 minutes Total marks: 50 Instructor: Rachel Pottinger Name ANSWER KEY (PRINT) (Last) (First) Signature

More information

CSE344 Midterm Exam Winter 2017

CSE344 Midterm Exam Winter 2017 CSE344 Midterm Exam Winter 2017 February 13, 2017 Please read all instructions (including these) carefully. This is a closed book exam. You are allowed a one page cheat sheet that you can write on both

More information

CSE-3421: Exercises. Winter 2011 CSE-3421 Exercises p. 1 of 18

CSE-3421: Exercises. Winter 2011 CSE-3421 Exercises p. 1 of 18 Winter 2011 CSE-3421 Exercises p. 1 of 18 CSE-3421: Exercises 1. Independence Answer #1.2 (page 23) from the textbook: What is logical data independence and why is it important? A short paragraph is sufficient.

More information

Exam II Computer Programming 420 Dr. St. John Lehman College City University of New York 20 November 2001

Exam II Computer Programming 420 Dr. St. John Lehman College City University of New York 20 November 2001 Exam II Computer Programming 420 Dr. St. John Lehman College City University of New York 20 November 2001 Exam Rules Show all your work. Your grade will be based on the work shown. The exam is closed book

More information

CSEN 501 CSEN501 - Databases I

CSEN 501 CSEN501 - Databases I CSEN501 - Databases I Lecture 5: Structured Query Language (SQL) Prof. Dr. Slim slim.abdennadher@guc.edu.eg German University Cairo, Faculty of Media Engineering and Technology Structured Query Language:

More information

Examination paper for TDT4145 Data Modelling and Database Systems

Examination paper for TDT4145 Data Modelling and Database Systems Department of Computer and Information Science Examination paper for TDT4145 Data Modelling and Database Systems Academic contact during examination: Svein Erik Bratsberg: 99539963 Roger Midtstraum: 99572420

More information

Midterm Examination CS 265 Spring 2015 Name: I will not use notes, other exams, or any source other than my own brain on this exam: (please sign)

Midterm Examination CS 265 Spring 2015 Name: I will not use notes, other exams, or any source other than my own brain on this exam: (please sign) Midterm Examination CS 265 Spring 2015 Name: I will not use notes, other exams, or any source other than my own brain on this exam: (please sign 1. (5 pts You have two relations R = [C, F, G] and P = [B,

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

Basic SQL. Dr Fawaz Alarfaj. ACKNOWLEDGEMENT Slides are adopted from: Elmasri & Navathe, Fundamentals of Database Systems MySQL Documentation

Basic SQL. Dr Fawaz Alarfaj. ACKNOWLEDGEMENT Slides are adopted from: Elmasri & Navathe, Fundamentals of Database Systems MySQL Documentation Basic SQL Dr Fawaz Alarfaj Al Imam Mohammed Ibn Saud Islamic University ACKNOWLEDGEMENT Slides are adopted from: Elmasri & Navathe, Fundamentals of Database Systems MySQL Documentation MIDTERM EXAM 2 Basic

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

2.2.2.Relational Database concept

2.2.2.Relational Database concept Foreign key:- is a field (or collection of fields) in one table that uniquely identifies a row of another table. In simpler words, the foreign key is defined in a second table, but it refers to the primary

More information

[12 marks] Consider this schema for Twitter, a social media platform where users post messages called tweets.

[12 marks] Consider this schema for Twitter, a social media platform where users post messages called tweets. Question 1. [12 marks] Consider this schema for Twitter, a social media platform where users post messages called tweets. Consider this relational schema for Twitter data. Keys are underlined. As this

More information

CPSC 310: Database Systems / CSPC 603: Database Systems and Applications Final Exam Fall 2005

CPSC 310: Database Systems / CSPC 603: Database Systems and Applications Final Exam Fall 2005 CPSC 310: Database Systems / CSPC 603: Database Systems and Applications Final Exam Fall 2005 Name: Instructions: 1. This is a closed book exam. Do not use any notes or books, other than your three 8.5-by-11

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

CPS 216 Spring 2003 Homework #1 Assigned: Wednesday, January 22 Due: Monday, February 10

CPS 216 Spring 2003 Homework #1 Assigned: Wednesday, January 22 Due: Monday, February 10 CPS 216 Spring 2003 Homework #1 Assigned: Wednesday, January 22 Due: Monday, February 10 Note: This is a long homework. Start early! If you have already taken CPS 196.3 or an equivalent undergraduate course

More information

EECS 647: Introduction to Database Systems

EECS 647: Introduction to Database Systems EECS 647: Introduction to Database Systems Instructor: Luke Huan Spring 2009 Stating Points A database A database management system A miniworld A data model Conceptual model Relational model 2/24/2009

More information

Relational Algebra. Relational Query Languages

Relational Algebra. Relational Query Languages Relational Algebra Davood Rafiei 1 Relational Query Languages Languages for describing queries on a relational database Three variants Relational Algebra Relational Calculus SQL Query languages v.s. programming

More information

Relational Model and Relational Algebra

Relational Model and Relational Algebra UNIT-III Relational Model and Relational Algebra 1) Define the following terms with an example for each. 8 Marks (Jun / July2014) Super key: A set of attributes SK of R such that no two tuples in any valid

More information

rate name People Consult Topics name rate name People Consult Topics name

rate name People Consult Topics name rate name People Consult Topics name Midterm Examination æ Please read all instructions èincluding theseè carefully. æ There are 5 problems on the exam, with a varying number of points for each problem and subproblem for a total of 75 points.

More information

CSE 344 Midterm Exam

CSE 344 Midterm Exam CSE 344 Midterm Exam February 9, 2015 Question 1 / 10 Question 2 / 39 Question 3 / 16 Question 4 / 28 Question 5 / 12 Total / 105 The exam is closed everything except for 1 letter-size sheet of notes.

More information

Relational Databases

Relational Databases Relational Databases Jan Chomicki University at Buffalo Jan Chomicki () Relational databases 1 / 49 Plan of the course 1 Relational databases 2 Relational database design 3 Conceptual database design 4

More information

COMP3311 Database Systems

COMP3311 Database Systems The University Of New South Wales Final Exam June 2004 COMP3311 Database Systems Time allowed: 3 hours Total number of questions: 7 Total number of marks: 150 Textbooks, study notes, calculators, mobile

More information

Set theory is a branch of mathematics that studies sets. Sets are a collection of objects.

Set theory is a branch of mathematics that studies sets. Sets are a collection of objects. Set Theory Set theory is a branch of mathematics that studies sets. Sets are a collection of objects. Often, all members of a set have similar properties, such as odd numbers less than 10 or students in

More information

Chapter 11 Database Concepts

Chapter 11 Database Concepts Chapter 11 Database Concepts INTRODUCTION Database is collection of interrelated data and database system is basically a computer based record keeping system. It contains the information about one particular

More information

QUIZ 1 REVIEW SESSION DATABASE MANAGEMENT SYSTEMS

QUIZ 1 REVIEW SESSION DATABASE MANAGEMENT SYSTEMS QUIZ 1 REVIEW SESSION DATABASE MANAGEMENT SYSTEMS SCHEMA DESIGN & RELATIONAL ALGEBRA A database schema is the skeleton structure that represents the logical view of the entire database Logical design of

More information

Relational Algebra and SQL

Relational Algebra and SQL Relational Algebra and SQL Relational Algebra. This algebra is an important form of query language for the relational model. The operators of the relational algebra: divided into the following classes:

More information

CSE 135. Applications View of a Relational Database Management System (RDBMS) SQL. Persistent data structure. High-level API for access &modification

CSE 135. Applications View of a Relational Database Management System (RDBMS) SQL. Persistent data structure. High-level API for access &modification CSE 135 SQL Applications View of a Relational Database Management System (RDBMS) Persistent data structure Large volume of data Independent from processes using the data High-level API for access &modification

More information

CSCE 4523 Introduction to Database Management Systems Final Exam Fall I have neither given, nor received,unauthorized assistance on this exam.

CSCE 4523 Introduction to Database Management Systems Final Exam Fall I have neither given, nor received,unauthorized assistance on this exam. CSCE 4523 Introduction to Database Management Systems Final Exam Fall 2016 I have neither given, nor received,unauthorized assistance on this exam. Signature Printed Name: Attempt all of the following

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

Introduction to Data Management CSE 344. Lectures 8: Relational Algebra

Introduction to Data Management CSE 344. Lectures 8: Relational Algebra Introduction to Data Management CSE 344 Lectures 8: Relational Algebra CSE 344 - Winter 2017 1 Announcements Homework 3 is posted Microsoft Azure Cloud services! Use the promotion code you received Due

More information

CSE 344 Midterm Nov 1st, 2017, 1:30-2:20

CSE 344 Midterm Nov 1st, 2017, 1:30-2:20 1 SQL 1. (36 points) Acompanymaintainsadatabaseabouttheiremployeesandprojectswiththefollowing schema. Employee(eid, name, salary) Project(pid, title, budget) WorksOn(eid, pid, year) WorksOn records which

More information

Database Management Systems (Classroom Practice Booklet Solutions)

Database Management Systems (Classroom Practice Booklet Solutions) Database Management Systems (Classroom Practice Booklet Solutions) 2. ER and Relational Model 4 ssn cid 01. Ans: (b) Professor Teaches course 02. Ans: (c) Sol: Because each patient is admitted into one

More information