Database Sample Examination



Similar documents
Part I: Entity Relationship Diagrams and SQL (40/100 Pt.)

Relational Database Design

Schema Design and Normal Forms Sid Name Level Rating Wage Hours

Schema Refinement and Normalization

Databases -Normalization III. (N Spadaccini 2010 and W Liu 2012) Databases - Normalization III 1 / 31

Chapter 8. Database Design II: Relational Normalization Theory

Relational Database Design: FD s & BCNF

Schema Refinement, Functional Dependencies, Normalization

CS143 Notes: Normalization Theory

Database Design and Normalization

Exercise 1: Relational Model

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

Functional Dependencies and Normalization

Relational Algebra. Module 3, Lecture 1. Database Management Systems, R. Ramakrishnan 1

B2.2-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

DATABASE MANAGEMENT SYSTEMS. Question Bank:

Jordan University of Science & Technology Computer Science Department CS 728: Advanced Database Systems Midterm Exam First 2009/2010

Week 11: Normal Forms. Logical Database Design. Normal Forms and Normalization. Examples of Redundancy

CSCI-GA Database Systems Lecture 7: Schema Refinement and Normalization

Lecture Notes on Database Normalization

Transaction Management Overview

RELATIONAL DATABASE DESIGN

Carnegie Mellon Univ. Dept. of Computer Science Database Applications. Overview - detailed. Goal. Faloutsos CMU SCS

Design of Relational Database Schemas

Chapter 10. Functional Dependencies and Normalization for Relational Databases

City University of Hong Kong. Information on a Course offered by Department of Computer Science with effect from Semester A in 2014 / 2015

DATABASE NORMALIZATION

Why Is This Important? Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) Example (Contd.)

Theory of Relational Database Design and Normalization

normalisation Goals: Suppose we have a db scheme: is it good? define precise notions of the qualities of a relational database scheme

10CS54: DATABASE MANAGEMENT SYSTEM

SQL DDL. DBS Database Systems Designing Relational Databases. Inclusion Constraints. Key Constraints

Database Design and Normalization

Theory behind Normalization & DB Design. Satisfiability: Does an FD hold? Lecture 12

Relational Database Design Theory

6.830 Lecture PS1 Due Next Time (Tuesday!) Lab 1 Out today start early! Relational Model Continued, and Schema Design and Normalization

Homework 8. Revision : 2015/04/14 08:13

Database Management Systems. Redundancy and Other Problems. Redundancy

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur

Relational Normalization Theory (supplemental material)

Limitations of E-R Designs. Relational Normalization Theory. Redundancy and Other Problems. Redundancy. Anomalies. Example

Transactions and the Internet

Chapter 7: Relational Database Design

LiTH, Tekniska högskolan vid Linköpings universitet 1(7) IDA, Institutionen för datavetenskap Juha Takkinen

Relational Algebra and SQL

DBMS Questions. 3.) For which two constraints are indexes created when the constraint is added?

Databases What the Specification Says

BCA. Database Management System

Database Tuning and Physical Design: Execution of Transactions

Question 1. Relational Data Model [17 marks] Question 2. SQL and Relational Algebra [31 marks]

Introduction Decomposition Simple Synthesis Bernstein Synthesis and Beyond. 6. Normalization. Stéphane Bressan. January 28, 2015

Database Design and Normal Forms

Project 2 Database Design and ETL

Lecture 7: Concurrency control. Rasmus Pagh

CS 377 Database Systems. Database Design Theory and Normalization. Li Xiong Department of Mathematics and Computer Science Emory University

IT2304: Database Systems 1 (DBS 1)

THE UNIVERSITY OF TRINIDAD & TOBAGO

Functional Dependencies and Finding a Minimal Cover

Concurrency Control. Module 6, Lectures 1 and 2

CSE 444 Midterm Test

IT2305 Database Systems I (Compulsory)

COSC344 Database Theory and Applications. Lecture 9 Normalisation. COSC344 Lecture 9 1

Determination of the normalization level of database schemas through equivalence classes of attributes

TYPICAL QUESTIONS & ANSWERS

Normalization in Database Design

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

The University of British Columbia

SAMPLE FINAL EXAMINATION SPRING SESSION 2015

Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases

LOGICAL DATABASE DESIGN

Databases and BigData

Functional Dependencies

Introduction to Database Systems. Normalization

Theory of Relational Database Design and Normalization

Goals. Managing Multi-User Databases. Database Administration. DBA Tasks. (Kroenke, Chapter 9) Database Administration. Concurrency Control

Comp 3311 Database Management Systems. 2. Relational Model Exercises

14 Databases. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

COMP 5138 Relational Database Management Systems. Week 5 : Basic SQL. Today s Agenda. Overview. Basic SQL Queries. Joins Queries

Chapter 10 Functional Dependencies and Normalization for Relational Databases

Chapter 10. Functional Dependencies and Normalization for Relational Databases. Copyright 2007 Ramez Elmasri and Shamkant B.

Chapter 5. SQL: Queries, Constraints, Triggers

Normalization. CIS 331: Introduction to Database Systems

Course Content. Transactions and Concurrency Control. Objectives of Lecture 4 Transactions and Concurrency Control

Scheme G. Sample Test Paper-I

Database Design Final Project

SQL: Queries, Programming, Triggers

Example Instances. SQL: Queries, Programming, Triggers. Conceptual Evaluation Strategy. Basic SQL Query. A Note on Range Variables

Advanced Relational Database Design

Boats bid bname color 101 Interlake blue 102 Interlake red 103 Clipper green 104 Marine red. Figure 1: Instances of Sailors, Boats and Reserves

SQL: Queries, Programming, Triggers

Conceptual Design Using the Entity-Relationship (ER) Model

Fundamentals of Database System

Graham Kemp (telephone , room 6475 EDIT) The examiner will visit the exam room at 15:00 and 17:00.

Foundations of Information Management

Database Systems Concepts, Languages and Architectures

Transactions and Concurrency Control. Goals. Database Administration. (Manga Guide to DB, Chapter 5, pg , ) Database Administration

Topics. Introduction to Database Management System. What Is a DBMS? DBMS Types

Database Management System

CSE-3421: Exercises. with answers


Transcription:

Part 1: SQL Database Sample Examination (Spring 2007) Question 1: Draw a simple ER diagram that results in a primary key/foreign key constraint to be created between the tables: CREATE TABLE Salespersons ( sid CHAR(10), primary key (sid)) CREATE TABLE Customers( cid CHAR(10), sid CHAR(10), PRIMARY KEY (cid), FOREIGN KEY (sid) REFERENCES Salespersons) Question 2: Consider the following schema for an airline database: FLIGHTS (flight_num, source_city, destination_city) DEPARTURES (flight_num, date, plane_type) PASSENGERS ( passenger_id, passenger_name, passenger_address ) BOOKINGS ( passenger_id, flight_num, date, seat_number ) The key fields are underlined. Express the following queries in SQL (feel free to abbreviate relation and attribute names and to use INTERSECT and EXCEPT if you need to). 1) Find the passenger_id of all passengers who have a seat booked on a plane of type 747 from Amsterdam to Washington. (Do not return any duplicate values) 2) Find the cities that have direct (non-stop) flights to both Honolulu and Newark. 3) Find the flight_num and data of all flights for which there are no reservations Question 3: Consider the following schema: Sailors ( sid,, rating, age ) Boats ( bid, bname, color ) Reserves ( sid, bid, day ) The key fields are underlined. Please indicate whether the relational algebra expressions are equivalent to each other based on the given queries. 1) Find the names of sailor who have reserved boat 107. π ( σ bid = 107 (Re serves >< Sailors)) π (( σ bid = 107 Re serves) >< Sailors) 2) Find the names of sailors who have reserved a blue boat. π (( σ color= ' blue' Boats) >< Re serves >< Sailors) π π (( π σ Boats) >< Re serves) Sailors) ( sid bid color= ' blue' >< - 1 -

3) Find the names of sailors who have reserved a red or a green boat. ρ ( Tempboats,( σ color= ' red ' Boats) ( σ color= ' green' Boats)) π ( Tempboats >< Re serves >< Sailors) ρ ( Tempboats,( σ color= ' red ' color= ' green' Boats)) π ( Tempboats >< Re serves >< Sailors) Question 4: Given the SQL queries: Q1: SELECT a FROM R WHERE b >= ANY(SELECT d FROM S WHERE c>10); Q2: SELECT a FROM R WHERE b >= ALL(SELECT d FROM S WHERE c>10); (A) Q1 and Q2 produce the same answer. (B) The answer to Q1 is always contained in the answer to Q2. (C) The answer to Q2 is always contained in the answer to Q1. (D) Q1 and Q2 produce different answers. Question 5: In this question, R(x) is the schema of relation R. Q1: SELECT x FROM R rr WHERE NOT EXISTS( SELECT * FROM R WHERE x > rr.x); Q2: SELECT MAX(x) FROM R; (A) Q1 and Q2 produce the same answer. (B) The answer to Q1 is always contained in the answer to Q2. (C) The answer to Q2 is always contained in the answer to Q1. (D) Q1 and Q2 produce different answers. - 2 -

Part 2: Transaction Management Question 1: Given the interleaved schedules: Schedule 1 T 1 R(A) R(C) W(C) Commit T 2 R(C) W(C) R(B) W(B) Commit T 3 R(C) R(A) W(A) Commit Schedule 2 T 1 R(A) R(C) W(A) Commit T 2 R(C) R(B) W(B) Commit T 3 R(B) W(B) Commit Schedule 3 T 1 R(C) W(A) W(A) Commit T 2 W(A) R(B) W(B) Commit 1) Which of the following schedules are serializable? Give a serial schedule or identify possible anomalies. 2) Draw the precedence graph for all three schedules and check whether they are conflict-serializable or not. 3) Apply strict 2PL to the non-conflict-serializable schedules 4) In one of the schedules a deadlock emerges draw the waits-for-graph for this schedule after all transactions are captured in the deadlock situation. (Use X(.) to denote exclusive locks and S(.) to denote shared locks!) - 3 -

Part 3: Schema Refinement Question 1: Consider a relational schema ABCDEFGHIJ, which contains the following FDs: AB C, D E, AE G, GD H, IF J. 1) Check whether or not the functional dependencies entail a) ABD GH b) ABD HJ c) ABC G d) GD HE 2) Let A denote a key for the aforementioned relation. Derive a lossless join, dependency preserving decomposition in 3NF! 3) Test whether or not the decomposition is also in BCNF! 4) Prove formally the following theorem by using Armstrong s axioms! (Theorem: Any relation that satisfies X Y and X Z must also satisfy X YZ) - 4 -

Part 4: Questions Question 1: X R 1 W Non Overlap ISA Covers R 2 Y Z D Figure: E-R Diagram 1. In the E-R diagram in shown in figure 1, the diamond labeled R 1 depicts: (A) An entity (B) An entity set (C) An relationship (D) An relationship set 2. Based on the E-R diagram shown in figure 1, find the correct description for participation constraints: (A) For each entity x X, there exists at least one entity w W, such that xr 1 w (B) For each entity x X, the case, which there exists no entity w W such that xr 1 w, can happen (C) For each entity x X, there exists only one entity w W, such that xr 1 w (D) For each entity x X, there exists at most one entity w W, such that xr 1 w Question 2: What do the ACID properties stand for? Give a brief description of the four characteristics. Question 3: What are the serial schedule, equivalent schedules and serializable schedule? Question 4: What is a file organization? What is an index? What is the relationship between files and indexes? Can we have several indexes on a single file of records? Question 5: How is a data organized in a tree-based index? When would you use a tree-based index? - 5 -

Question 6: What are/is the primary goal(s) in schema normalization? Mark the correct answer(s). (A) Simplify the conceptual schema (B) Reduce number of tables (C) Avoid redundancy (D) Make the access of data more efficient Question 7: Describe briefly the three tiers of the three-tier-architecture! Provide at least the name of one computer language that is used for each one of these layers! - 6 -