CS425 Midterm Exam Summer C 2012

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

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

Intermediate SQL ( )

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

The Relational Model of Data (ii)

Database Management Systems. Chapter 3 Part 1

Relational data model

The Relational Data Model. Data Model

Database Applications (15-415)

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

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

Relational Query Languages

Integrity and Security

Database Systems ( 資料庫系統 )

The Relational Model. Chapter 3

The Relational Model

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

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

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

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

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

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

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

Introduction to Data Management. Lecture #4 E-R Model, Still Going

CS 582 Database Management Systems II

DBMS. Relational Model. Module Title?

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

The Relational Model

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

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

Relational Algebra Homework 0 Due Tonight, 5pm! R & G, Chapter 4 Room Swap for Tuesday Discussion Section Homework 1 will be posted Tomorrow

e e Conceptual design begins with the collection of requirements and results needed from the database (ER Diag.)

Database Systems. Course Administration

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

CompSci 516 Database Systems. Lecture 2 SQL. Instructor: Sudeepa Roy

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

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

Chapter 3: Introduction to SQL

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

The Relational Model. Week 2

Announcements If you are enrolled to the class, but have not received the from Piazza, please send me an . Recap: Lecture 1.

Review: Where have we been?

Introduction to Data Management. Lecture #3 (E-R Design, Cont d.)

CS 2451 Database Systems: Relational Data Model

Chapter 3: Introduction to SQL

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

CIS 330: Applied Database Systems

DATABASE TECHNOLOGY - 1MB025 (also 1DL029, 1DL300+1DL400)

GUJARAT TECHNOLOGICAL UNIVERSITY

Database Systems. Lecture2:E-R model. Juan Huo( 霍娟 )

EECS 647: Introduction to Database Systems

Databases Model the Real World. The Entity- Relationship Model. Conceptual Design. Steps in Database Design. ER Model Basics. ER Model Basics (Contd.

Chapter 3: Introduction to SQL. Chapter 3: Introduction to SQL

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

The Relational Model. Database Management Systems

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

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

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

EECS 647: Introduction to Database Systems

Databases Model the Real World. The Entity- Relationship Model. Conceptual Design. Steps in Database Design. ER Model Basics. ER Model Basics (Contd.

Relational Model. CSC 343 Winter 2018 MICHAEL LIUT

CS W Introduction to Databases Spring Computer Science Department Columbia University

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

MIS Database Systems Relational Algebra

CS2300: File Structures and Introduction to Database Systems

Relational model and basic SQL

COMP Instructor: Dimitris Papadias WWW page:

Chapter 7 Constraints and Triggers. Spring 2011 Instructor: Hassan Khosravi

QQ Group

Other Relational Languages

Domain Constraints Referential Integrity Assertions Triggers. Authorization Authorization in SQL

EGCI 321: Database Systems. Dr. Tanasanee Phienthrakul

CS5300 Database Systems

SQL: The Query Language Part 1. Relational Query Languages

Principles of Data Management

The Relational Model 2. Week 3

ER to Relational Model. Professor Jessica Lin

Introduction to SQL Part 1 By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford)

Page 1. Quiz 18.1: Flow-Control" Goals for Today" Quiz 18.1: Flow-Control" CS162 Operating Systems and Systems Programming Lecture 18 Transactions"

Overview of db design Requirement analysis Data to be stored Applications to be built Operations (most frequent) subject to performance requirement

Chapter 1: Introduction

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

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

CS275 Intro to Databases

Relational Algebra. Lecture 4A Kathleen Durant Northeastern University

Page 1. Goals for Today" What is a Database " Key Concept: Structured Data" CS162 Operating Systems and Systems Programming Lecture 13.

Keys, SQL, and Views CMPSCI 645

CS 405G: Introduction to Database Systems

CMPT 354: Database System I. Lecture 3. SQL Basics

2.2.2.Relational Database concept

COMP 430 Intro. to Database Systems

Chapter 2 Introduction to Relational Models

DATABASE DESIGN - 1DL400

Introduction to Database Systems

CMPT 354: Database System I. Lecture 2. Relational Model

Database Design Process

The Relational Model Constraints and SQL DDL

Database Management Systems MIT Introduction By S. Sabraz Nawaz

NOTE 1: This is a closed book examination. For example, class text, copies of overhead slides and printed notes may not be used. There are 11 pages.

Database Languages. A DBMS provides two types of languages: Language for accessing & manipulating the data. Language for defining a database schema

Transcription:

Q1) List five responsibilities of a database-management system. Q2) Fill in the terms in the right hand side of the table that match the description from the list below: Instance SQL Integrity constraints Schema Transaction Materializing a view Referential Integrity The grant statement Data Models Data Definition Language (DDL) guard against accidental damage to the database, by ensuring that authorized changes to the database do not result in a loss of data consistency. create a physical table containing all the tuples in the result of some query Unit of work is used to confer authorization Ensures that a value that appears in one relation for a given set of attributes also appears for a certain set of attributes in another relation the logical structure of the database the actual content of the database at a particular point in time A collection of tools for describing: Data, Data relationships, Data semantics and Data constraints Specification notation for defining the database schema widely used non procedural language Q3) how does WAL protocol work? And why? Page 1 of 8

Q4) use this relation to answer a thru e: sid name login age gpa 53666 Jones jones@cs 18 3.4 53688 Smith smith@eecs 18 3.2 53650 Smith smith@math 19 3.8 a. What is the cardinality and Degree of this relation? b. Find names and logins of all 18 year old students? Write the SQL code only. c. Write SQL to find the average of all grades? d. Write SQL to find all stands whose GPA is greater than the average? e. Find all students whose name starts with the letter S? Page 2 of 8

Q5) Giving r and s Relations below answer a thru c a. r x s: b. r s: c. r s: Page 3 of 8

Q6-3.11) Write the following queries in SQL, using the university schema. a. Find the names of all students who have taken at least one Comp. Sci. course; make sure there are no duplicate names in the result. b. Find the IDs and names of all students who have not taken any course offering before Spring 2009. c. For each department, find the maximum salary of instructors in that department. Youmay assume that every department has at least one instructor. d. Find the lowest, across all departments, of the per-department maximum salary computed by the preceding query. Page 4 of 8

Q7-3.12) Write the following queries in SQL, using the university schema. a. Create a new course CS-001, titled Weekly Seminar, with 0 credits. b. Create a section of this course in Autumn 2009, with section id of 1. c. Enroll every student in the Comp. Sci. department in the above section. d. Delete enrollments in the above section where the student s name is Chavez. e. Delete the course CS-001. Page 5 of 8

Q8-3.13) Write SQL DDL corresponding to the schema in the Figure below. Make any reasonable assumptions about data types, and be sure to declare primary and foreign keys. person (driver id, name, address) car (license, model, year) accident (report number, date, location) owns (driver id, license) participated (report number, license, driver id, damage amount) Page 6 of 8

Q9-4.14) Show how to define a view tot credits (year, num credits), giving the total number of credits taken by students in each year. Q10-4.16) Referential-integrity constraints involve exactly two relations. Consider a database that includes the relations shown in Figure below. Suppose that we wish to require that every name that appears in address appears in either salaried worker or hourly worker, but not necessarily in both. a. Propose a syntax for expressing such constraints. b. Discuss the actions that the system must take to enforce a constraint of this form. salaried worker (name, office, phone, salary) hourly worker (name, hourly wage) address (name, street, city) Page 7 of 8

Scheme Diagram from University Database Page 8 of 8