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

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

The Relational Model

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

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

The Relational Model. Relational Data Model Relational Query Language (DDL + DML) Integrity Constraints (IC)

The Relational Model

The Relational Model. Chapter 3

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

The Relational Model. Chapter 3. Comp 521 Files and Databases Fall

The Relational Data Model. Data Model

The Relational Model. Chapter 3. Database Management Systems, R. Ramakrishnan and J. Gehrke 1

Introduction to Database Systems

Database Management Systems. Chapter 3 Part 1

The Relational Model. Week 2

CS425 Midterm Exam Summer C 2012

Database Applications (15-415)

Database Management Systems

The Relational Model 2. Week 3

Relational data model

Example Examination. Allocated Time: 100 minutes Maximum Points: 250

Data Modeling. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke

Database Systems ( 資料庫系統 )

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

1/19/2012. Finish Chapter 1. Workers behind the Scene. CS 440: Database Management Systems

Lecture 2 08/26/15. CMPSC431W: Database Management Systems. Instructor: Yu- San Lin

CS 146 Database Systems

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

The Relational Model of Data (ii)

CSE 444, Winter 2011, Midterm Examination 9 February 2011

CSE 344 Midterm. Monday, November 9th, 2015, 9:30-10:20. Question Points Score Total: 70

Why Study the Relational Model? The Relational Model. Relational Database: Definitions. The SQL Query Language. Relational Query Languages

The Relational Model. Why Study the Relational Model? Relational Database: Definitions

Introduction and Overview

Big Data Processing Technologies. Chentao Wu Associate Professor Dept. of Computer Science and Engineering

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

Announcements. PS 3 is out (see the usual place on the course web) Be sure to read my notes carefully Also read. Take a break around 10:15am

Introduction to Data Management. Lecture #1 (The Course Trailer )

Database Management Systems MIT Introduction By S. Sabraz Nawaz

Midterm Exam #2 (Version A) CS 122A Winter 2017

CSC 261/461 Database Systems Lecture 13. Fall 2017

EGCI 321: Database Systems. Dr. Tanasanee Phienthrakul

CSEN 501 CSEN501 - Databases I

CS3DB3/SE4DB3/SE6M03 TUTORIAL

CS564: Database Management Systems. Lecture 1: Course Overview. Acks: Chris Ré 1

Lecture 2 SQL. Announcements. Recap: Lecture 1. Today s topic. Semi-structured Data and XML. XML: an overview 8/30/17. Instructor: Sudeepa Roy

Administrivia. The Relational Model. Review. Review. Review. Some useful terms

Database Systems ( 資料庫系統 ) Practicum in Database Systems ( 資料庫系統實驗 ) 9/20 & 9/21, 2006 Lecture #1

Relational Databases BORROWED WITH MINOR ADAPTATION FROM PROF. CHRISTOS FALOUTSOS, CMU /615

Review. The Relational Model. Glossary. Review. Data Models. Why Study the Relational Model? Why use a DBMS? OS provides RAM and disk

Lecture 2 SQL. Instructor: Sudeepa Roy. CompSci 516: Data Intensive Computing Systems

KINGDOM OF SAUDI ARABIA-JAZAN UNIVERSITY COLLEGE OF COMPUTER SCIENCE & INFORMATION SYSTEMS 221 INFS 3 DATABASE SYSTEMS-1 REVIEW QUESTIONS

CS145: Intro to Databases. Lecture 1: Course Overview

The Relational Model. Outline. Why Study the Relational Model? Faloutsos SCS object-relational model

Comp 5311 Database Management Systems. 4b. Structured Query Language 3

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

CS275 Intro to Databases. File Systems vs. DBMS. Why is a DBMS so important? 4/6/2012. How does a DBMS work? -Chap. 1-2

CS2300: File Structures and Introduction to Database Systems

Introduction and Overview

The Relational Model. Roadmap. Relational Database: Definitions. Why Study the Relational Model? Relational database: a set of relations

Data! CS 133: Databases. Goals for Today. So, what is a database? What is a database anyway? From the textbook:

BBM371- Data Management. Lecture 1: Course policies, Introduction to DBMS

Lecture 16. The Relational Model

Modern Database Systems CS-E4610

COMP 244 DATABASE CONCEPTS AND APPLICATIONS

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

VIEW OTHER QUESTION PAPERS

Introduction to Data Management. Lecture #2 Intro II & Data Models I

CIS 330: Applied Database Systems

The Relational Model (ii)

LAB 3 Notes. Codd proposed the relational model in 70 Main advantage of Relational Model : Simple representation (relationstables(row,

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

Midterm 2: CS186, Spring 2015

CS430/630 Database Management Systems Spring, Betty O Neil University of Massachusetts at Boston

CS145: Intro to Databases. Lecture 1: Course Overview

SQL Retrieving Data from Multiple Tables

Database Systems. Course Administration

Midterm Exam #1 Version B CS 122A Winter 2017

The Relational Model Constraints and SQL DDL

Lecture 3: SQL Part II

Today's Class. Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Example Database. Query Plan Example

Integrity constraints, relationships. CS634 Lecture 2

Introduction to Data Management. Lecture #1 (Course Trailer ) Instructor: Chen Li

Announcements (September 14) SQL: Part I SQL. Creating and dropping tables. Basic queries: SFW statement. Example: reading a table

COURSE OUTLINE. School of Engineering Technology and Applied Science

9/8/2018. Prerequisites. Grading. People & Contact Information. Textbooks. Course Info. CS430/630 Database Management Systems Fall 2018

Spring 2013 CS 122C & CS 222 Midterm Exam (and Comprehensive Exam, Part I) (Max. Points: 100)

King Fahd University of Petroleum and Minerals

The Relational Model. Database Management Systems

Review: Where have we been?

Introduction to Database Management Systems

Midterm Exam (Version B) CS 122A Spring 2017

LAB 2 Notes. Conceptual Design ER. Logical DB Design (relational) Schema Refinement. Physical DD

Database Applications (15-415)

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #2: The Relational Model and Relational Algebra

Database Management Systems MIT Lesson 01 - Introduction By S. Sabraz Nawaz

CS5300 Database Systems

CSE 344 Midterm. Monday, November 9th, 2015, 9:30-10:20. Question Points Score Total: 70

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

EECS 647: Introduction to Database Systems

Announcements (September 18) SQL: Part II. Solution 1. Incomplete information. Solution 3? Solution 2. Homework #1 due today (11:59pm)

Transcription:

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 This is a closed-book exam. You are only allowed one letter-size sheet of paper. This examination paper consists of 9 pages and 5 sections. Please bring any discrepancy to the attention of an invigilator. The number in parenthesis at the start of each question is the number of points the question is worth. Answer all questions. Please write your answers clearly. For instructor s use: 1 (10) 2 (10) 3 (8) 4 (13) 5 (9) Total (50) Score Page 1 of 9

For this exam, consider the following schema and instances of the relations. Feel free to remove this page from the exam. Attributes with an empty value should be assumed to be NULL. Students(sid:integer, name:string, login:string, age: integer, gpa: real) sid name login age gpa 53666 Mary Elizabeth me@cs 18 7.4 53668 Quintin quintin@ee 18 7.8 53650 Pierre pierre@math 19 7.4 53831 Cathy cathy@music 11 8 53832 Reuven reuven@music 12 Courses(cid: string, cname: string, credits: integer) cid cname credits SENG265 Introduction to Software Engineering 3 CSC370 Database Systems 3 CSC360 Introduction to Operating Systems 3 CSC320 Foundations in Computer Science 3 Enrolled(sid: integer, cid: string, grade: string) sid cid grade 53666 SENG265 98 53666 CSC370 78 53668 CSC370 91 53832 SENG265 PAGE 2

1. Database Concepts (a) [4] Give 4 advantages of using a DBMS to manage data. Be brief. (b) [2] Explain why physical data independence is important. Be Brief. (c) [3] List 3 of the tasks a DBA is responsible for. (d) [1] Who invented the relational model for databases? PAGE 3

2. Database Design (a) [5] Draw the Entity Relationship diagram for the following database: A university database contains information about professors (employeenumber, name and salary) and courses (coursename, term, year, section, name, and department). Professors can be uniquely identified by their employeenumber, while courses can be uniquely identified by their coursename, term, year and section. Professors teach courses, but there is the restriction that a given course can only be taught by at most one professor. (b) [5] For the following diagram, provide CREATE TABLE statements for the entities Employees, Courses and for the relation teaches. Choose appropriate data types for each field and include any referential integrity constraints. ssn name lot year courseid year Employees teaches Course PAGE 4

3. Relational Model (a) [2] What is the arity, cardinality and degree of the relation Enrolled in page 2? Give relational algebra expressions for the following questions using the schema in page 2. (a) [3] The cname of the courses for which the student with name Jones has a grade bigger than 90. (b) [3] The cname of each course that does not have students enrolled. PAGE 5

4. Writing SQL queries Answer the following questions using the schema in page 2. (a) [3] Provide a SELECT statement that retrieves for every student enrolled in a course, their name and the name of the course (cname) in which he/she is enrolled. (b) [3] Provide a SELECT statement that retrieves the name of each course (cname) that does not have students enrolled. PAGE 6

(c) [3] Provide a SELECT statement that retrieves every student id (sid) and the total number of credits they have completed (total number of credits of the courses for which they have received a grade). (d) [4] Provide a SELECT statement that groups students who are at least 18 years old by their age. For each of these groups compute their average gpa and order the result by age (in ascending order). PAGE 7

5. Interpreting SQL queries Based on the instances of page 2, what is the answer to the following queries? (a) [3] SELECT count(gpa) as count, max(gpa) as Maximum, min(gpa) as Minimum FROM Students WHERE sid IN (SELECT sid FROM Enrolled) (b) [3] SELECT * FROM Enrolled NATURAL RIGHT OUTER JOIN Courses PAGE 8

(c) [3] SELECT S.sid, AVG(grade) as Average FROM Students S, Enrolled E WHERE S.age <= 18 and S.sid = E.sid GROUP BY S.sid HAVING count(grade) > 0 End of examination Total pages: 9 Total marks: 50 PAGE 9