Database Systems CSE Comprehensive Exam Spring 2005

Similar documents
Database Systems. Answers

1. (a) Explain the Transaction management in a database. (b) Discuss the Query Processor of Database system structure. [8+8]

Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity Sets Extended E-R Features Design of the Bank Database Reduction to

Northern India Engineering College, New Delhi Question Bank Database Management System. B. Tech. Mechanical & Automation Engineering V Semester

1. Considering functional dependency, one in which removal from some attributes must affect dependency is called

Example: specific person, company, event, plant

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

CS352 - DATABASE SYSTEMS. To give you experience with developing a database to model a real domain

CS352 - DATABASE SYSTEMS

Chapter 6: Entity-Relationship Model

Lecture 14 of 42. E-R Diagrams, UML Notes: PS3 Notes, E-R Design. Thursday, 15 Feb 2007

COMP Instructor: Dimitris Papadias WWW page:

Chapter 7: Relational Database Design

Chapter 6: Relational Database Design

CSCC43H: Introduction to Databases. Lecture 3

customer = (customer_id, _ customer_name, customer_street,

Database System Concepts, 5 th Ed.! Silberschatz, Korth and Sudarshan See for conditions on re-use "

QQ Group

MaanavaN.Com DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING QUESTION BANK

GUJARAT TECHNOLOGICAL UNIVERSITY

Entity-Relationship Model

Simple SQL Queries (2)

VIEW OTHER QUESTION PAPERS

Chapter 6: Formal Relational Query Languages

Textbook: Chapter 6! CS425 Fall 2013 Boris Glavic! Chapter 3: Formal Relational Query. Relational Algebra! Select Operation Example! Select Operation!

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

Chapter 2: Relational Model

DATABASE MANAGEMENT SYSTEM

Chapter 6: Entity-Relationship Model

DBMS: AN INTERACTIVE TUTORIAL

Chapter 2: Entity-Relationship Model. Entity Sets. Entity Sets customer and loan. Attributes. Relationship Sets. A database can be modeled as:

CMSC 424 Database design Lecture 18 Query optimization. Mihai Pop

Lecture 11 - Chapter 8 Relational Database Design Part 1

Chapter 5: Other Relational Languages

consider the following tables pertaining to employees working for different Write the SQL statement to retrieve the average age of employees for each

Chapter 6: Entity-Relationship Model

Schema Normalization. 30 th August Submitted By: Saurabh Singla Rahul Bhatnagar

Babu Banarasi Das National Institute of Technology and Management

Schema And Draw The Dependency Diagram

CSIT5300: Advanced Database Systems

CS2255 DATABASE MANAGEMENT SYSTEMS QUESTION BANK UNIT I

ADVANCED DATABASES ; Spring 2015 Prof. Sang-goo Lee (11:00pm: Mon & Wed: Room ) Advanced DB Copyright by S.-g.

The University of British Columbia

2. E-R Model. Entity Sets Relationship Sets Attributes

Normalization Rule. First Normal Form (1NF) Normalization rule are divided into following normal form. 1. First Normal Form. 2. Second Normal Form

CSCC43H: Introduction to Databases. Lecture 4

IS 263 Database Concepts

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

Conceptual Data Models for Database Design

Chapter 8: Relational Algebra

Other Relational Query Languages

UNIT II A. ENTITY RELATIONSHIP MODEL

6.1 RELATIONSHIP CONCEPTS

Chapter 2 ENTITY RELATIONSHIP MODEL

ACS-2914 Normalization March 2009 NORMALIZATION 2. Ron McFadyen 1. Normalization 3. De-normalization 3

Database System Concepts

The Relational Model

VALLIAMMAI ENGINEERING COLLEGE

ERRATA for Database System Concepts, 5 th Edition Silberschatz, Korth, and Sudarshan. March 19, 2007

Unit 2 - Data Modeling. Pratian Technologies (India) Pvt. Ltd.

UNIT 2 RELATIONAL MODEL

CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam

A database can be modeled as: + a collection of entities, + a set of relationships among entities.

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

Code No. : 9919 Sub. Code : HCAM 35

Sankalchand Patel College of Engineering, Visnagar B.E. Semester III (CE/IT) Database Management System Question Bank / Assignment

Combining schemas. Problems: redundancy, hard to update, possible NULLs

Homework 6: FDs, NFs and XML (due April 15 th, 2015, 4:00pm, hard-copy in-class please)


Other Query Languages II. Winter Lecture 12

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

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

MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38

MIS Database Systems Entity-Relationship Model.

Database System Concepts, 5th Ed.! Silberschatz, Korth and Sudarshan See for conditions on re-use "

CS6302- DATABASE MANAGEMENT SYSTEMS- QUESTION BANK- II YEAR CSE- III SEM UNIT I

PLEASE HAND IN UNIVERSITY OF TORONTO Faculty of Arts and Science

Distributed Query Processing. Banking Example

DATABASE TECHNOLOGY. Spring An introduction to database systems

Logical Database Design. ICT285 Databases: Topic 06

Normalisation Chapter2 Contents

UNIVERSITI SAINS MALAYSIA. CIT503 Databases and E-Commerce Rapid Application Development. CSI512 Database Management Systems

Chapter 2: Entity-Relationship Model

CSCC43H: Introduction to Databases

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

Weak Entity Sets. A weak entity is an entity that cannot exist in a database unless another type of entity also exists in that database.

The Next Step: Designing DB Schema. Chapter 6: Entity-Relationship Model. The E-R Model. Identifying Entities and their Attributes.

The Relational Model and Normalization

CS211 Lecture: Database Design

UNIVERSITY OF BOLTON WESTERN INTERNATIONAL COLLEGE FZE BSC (HONS) COMPUTING SEMESTER ONE EXAMINATION 2015/2016 DATABASE THEORY AND PRACTICE

VARDHAMAN COLLEGE OF ENGINEERING Shamshabad , Hyderabad B.Tech. CSE IV Semester (VCE - R11) T P C 3+1* -- 4 (A1511) DATABASE MANAGEMENT SYSTEMS

SQL QUERIES. CS121: Relational Databases Fall 2017 Lecture 5

Entity Relationship Model

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

FINAL EXAM REVIEW. CS121: Introduction to Relational Database Systems Fall 2018 Lecture 27

Course on Database Design Carlo Batini University of Milano Bicocca

Relational Algebra. Relational Algebra. 7/4/2017 Md. Golam Moazzam, Dept. of CSE, JU

Chapter 3: SQL. Database System Concepts, 5th Ed. Silberschatz, Korth and Sudarshan See for conditions on re-use

DATABASE DESIGN I - 1DL300

CS403- Database Management Systems Solved MCQS From Midterm Papers. CS403- Database Management Systems MIDTERM EXAMINATION - Spring 2010

Transcription:

Database Systems CSE 5260 Spring 2005

Database Schema #1 Branch (Branch_Name, Branch_City, Assets) Customer (Customer_Name, SS#, Street, City, State, Zip_Code) Account (Account_Number, Branch_Name, Balance) Loan (Loan_Number, Branch_Name, Amount) Depositor (SS#, Account_Number) Borrower (SS#, Loan_Number)

Problem #1 (15 pts) Refer to the Database Schema #1. a) SQL - Find the names of all branches in the loan relations. Remove duplicate branch names. b) SQL Find all customers who have both a loan and an account at the bank. c) SQL Find the customer names and their loan numbers for all customers having a loan at some branch.

Problem #2 (15 pts) Consider the following relational schemes fro storing information associated with a hospital. Patient (SS#, name, policy#) Visit (SS#, date-admitted, time-admitted) Doctor (DrSS#, name, specialty) Log (SS#, DrSS#, test_type, date, result) Provide a relational algebra expression for each of the following. a) A list of the social security numbers for those patients who had a test for asthma on the same date that they were admitted. b) A list of the social security numbers or those patients who visited (admitted) the hospital on 01/01/05. c) A list of the social security numbers of those patients who have each had a test for asthma and a test for anemia, but never had a test for bronchitis.

Problem #3 (15 pts) Suppose that a database is to be developed for the information associated with a university. Information stored must include basic student and faculty information, which students are advised by which faculty, which students are registered for which courses, and which faculty teach which courses. Note that in this university students can register for one or more courses, each student has exactly one advisor, each faculty member advises one or more students, every faculty member teaches one or more courses, and every faculty member has a unique office. In addition, every student, faculty, and course has a unique id number. Finally, a history of student grades is also to be maintained. The history must contain a record of a grade for each course taken by a student. Furthermore, if a student repeats a class multiple times, the history must contain an entry for each and every time the student takes the class. Suppose that the following relational schemes are identified from the above description. Student (student_id, city, street, major) Faculty (faculty_id, address, office_number) Advisor (faculty_id, student_id) Registered (student_id, course_id) Teacher (faculty_id, course_id) Grades (student_id, course_id, date, grade) - Students currently registered in the university - University faculty - The names of students and their advisors. - Specifies courses each student is currently registered in. - Specifies which faculty currently teach which courses. - Specifies the course grade for a student, and when they received that grade. a) What would be a candidate key for the advisor entity set? b) Would faculty_id, office_number be a candidate key for the faculty entity set?

Problem #3 (continued) Student (student_id, city, street, major) Faculty (faculty_id, address, office_number) Advisor (faculty_id, student_id) Registered (student_id, course_id) Teacher (faculty_id, course_id) Grades (student_id, course_id, date, grade) - Students currently registered in the university - University faculty - The names of students and their advisors. - Specifies courses each student is currently registered in. - Specifies which faculty currently teach which courses. - Specifies the course grade for a student, and when they received that grade. c) What would be a candidate key for the grades entity set? d) List all of the candidate keys for the student entity set. e) List all of the super keys for the faculty entity set

Problem # 4 (5 pts) Refer to the Database Schema #1 Provide the SQL statements to drop and create the Customer Schema. Problem #5 (10 pts) a) Under what circumstances would one consider using a file based system instead of a Database Management System (DBMS)? b) Under what circumstances would one consider using a DBMS instead of a file based system? Problem # 6 (15 pts) Draw a 3 tier top level architecture for an automated banking teller machine. Explain the events that must occur for the withdrawal of cash from an account. Should the architecture support asynchronous or synchronous communications?

Problem # 7 (10 pts) The Entity Relationship Diagram shows that a person owns some number of cars and each vehicle is insured by an Insurance Company. The problem is that an Insurance policy may insure more than one car, which makes the Insurance Schema a weak entity. a) Redesign the Database Schema using only binary relationships and no entity schema is a weak. b) Create the Relational Tables for your new design. Last Name First Name SS# Vehicle ID Type Make Person Has Vehicle Birth Date Age Gender Year Doors Color # of Accidents Expiration Date Insurance Cost per Accident Cost Policy Number

Problem # 8 (5 pts) Employee Department ( Employee-Name, SS, Birth-Date, Address, Dept-Number, Dept-Name, Dept-Mgr-SS) Functional Dependencies: FD1 = SS Employee-Name, Birth-Date, Address, Dept-Number FD2 = Dept-Number Dept-Name, Dept-Mgr-SS Is this table in 3 rd Normal Form? Convert the Relational Table into 3 rd Normal Form if your answer is No. Problem # 9 (5 pts) Employee Project ( SS, Project-Number, Employee-Name, Hours, Project-Name, Project-Location) Functional Dependencies: FD1 = SS Employee-Name FD2 = SS, Project-Number Hours FD2 = Project-Number Project-Name, Project Location Convert the Relational Table into 2 rd Normal Form.

Problem # 10 (5 pts) Interest ( SS, Last-Name, First-Name, Hobbies) Is this schema in the 1 st Normal Form, 2 nd Normal Form, 3 rd Normal Form, 4 th Normal Form, or all Normal Forms? Please explain your answer.

Database Systems CSE 5260 Fall 2005

Database Schema #1 Branch (Branch_Name, Branch_City, Assets) Customer (Customer_Name, SS#, Street, City, State, Zip_Code) Account (Account_Number, Branch_Name, Balance) Loan (Loan_Number, Branch_Name, Amount) Depositor (SS#, Account_Number) Borrower (SS#, Loan_Number)

Problem #1 (15 pts) Refer to the Database Schema #1. a) SQL - Find the names of all branches in the loan relations. Remove duplicate branch names. b) SQL Find all customers who have both a loan and an account at the bank. c) SQL Find the customer names and their loan numbers for all customers having a loan at some branch. Problem # 2 (5 pts) Refer to the Database Schema #1 Provide the SQL statements to drop and create the Customer Schema.

Problem #3 (15 pts) Consider the following relational schemes for storing information associated with a hospital. Patient (SS#, name, policy#) Visit (SS#, date-admitted, time-admitted) Doctor (DrSS#, name, specialty) Log (SS#, DrSS#, test_type, date, result) Provide a relational algebra expression for each of the following. a) A list of the social security numbers for those patients who had a test for asthma on the same date that they were admitted. b) A list of the social security numbers or those patients who visited (admitted) the hospital on 01/01/05. c) A list of the social security numbers of those patients who have each had a test for asthma and a test for anemia, but never had a test for bronchitis.

Problem #4 (15 pts) a) Define first normal form (1NF). b) Define second normal form (2NF). c) Define third normal form (3NF). Problem #5 (10 pts) a) Under what circumstances would one consider using a file based system instead of a Database Management System (DBMS)? b) Under what circumstances would one consider using a DBMS instead of a file based system? Problem # 6 (15 pts) Draw a 3 tier top level architecture for an automated banking teller machine. Explain the events that must occur for the withdrawal of cash from an account. Should the architecture support asynchronous or synchronous communications?

Problem # 7 (10 pts) The Entity Relationship Diagram shows that a person owns some number of cars and each vehicle is insured by an Insurance Company. The problem is that an Insurance policy may insure more than one car, which makes the Insurance Schema a weak entity. a) Redesign the Database Schema using only binary relationships and no entity schema is a weak. b) Create the Relational Tables for your new design. Last Name First Name SS# Vehicle ID Type Make Person Has Vehicle Birth Date Age Gender Year Doors Color # of Accidents Expiration Date Insurance Cost per Accident Cost Policy Number

Problem # 8 (5 pts) Employee Department ( Employee-Name, SS, Birth-Date, Address, Dept-Number, Dept-Name, Dept-Mgr-SS) Functional Dependencies: FD1 = SS Employee-Name, Birth-Date, Address, Dept-Number FD2 = Dept-Number Dept-Name, Dept-Mgr-SS Is this table in 3 rd Normal Form? Convert the Relational Table into 3 rd Normal Form if your answer is No. Problem # 9 (5 pts) Employee Project ( SS, Project-Number, Employee-Name, Hours, Project-Name, Project-Location) Functional Dependencies: FD1 = SS Employee-Name FD2 = SS, Project-Number Hours FD2 = Project-Number Project-Name, Project Location Convert the Relational Table into 2 rd Normal Form.

Problem # 10 (5 pts) Interest ( SS, Last-Name, First-Name, Hobbies) Is this schema in the 1 st Normal Form, 2 nd Normal Form, 3 rd Normal Form, 4 th Normal Form, or all Normal Forms? Please explain your answer.

Database Systems CSE 5260 Spring 2006

Database Schema #1 Student (SS#, Student_Name, street, city, State, ZIP) Offering (department, number, section, time, location, population) -- Courses currently offered for CSE 5260 department is CSE and number is 5260. Titles (department, number, title) Enrollment (student-name, department, number, section)

Problem #1 (20 pts) Refer to Database Schema #1. Give a SQL expression for each of the following. a) Provide the department, number, section, and title for every course section that has more than 25 students enrolled; i.e., the population > 25. b) Provide a list of cities that have at least two student residents. c) Provide a list of students that live in Orlando and take the course Database. Sort the list in alphabetical order. d) Provide a list of student names, department, number, title and population for all courses offered. Sort the list by the course titles.

Problem #2 (25 pts) a) Define first normal form (1NF). b) Define second normal form (2NF). c) Define third normal form (3NF). d) Provide a formal definition for Functional Dependency Preservation. e) Define what is meant by a non-procedural query language? Give an example of a procedural and non-procedural query language. Problem #3 (10 pts) Under what circumstances would one consider using a file based system instead of a Database Management System (DBMS)?

Problem # 4 (15 pts) Create the Relational Database Tables for the Entity Relationship Diagram shown below. Underline the primary keys. The schema shows that a person can own and drive multiple vehicles and insure the vehicles under one insurance policy. The attribute # of Accidents, Cost, and Expiration Date applies to each car, which makes the relation schema Insurance a weak entity. Last Name First Name SS# Vehicle ID Type Make Person drives Vehicle Birth Date Age Gender Year Color Expiration Date Insurance # of Accidents Cost Policy Number

Problem # 5 (15 pts) Employee ( SS#, Project-Number, Last-Name, First-Name, Street, Zip, Project-Name, Project-Location) Address (Zip, City, County, State) Convert the database schema into 3rd Normal Form. Problem # 6 (15 pts) a) Provide an example of a loss-less join decomposition. Ensure you provide an adequate explanation for your example. b) Suppose a relation schema R is decomposed into {R1, R2}. What conditions must hold true to ensure the decomposition is loss-less. c) Suppose a relation schema R with functional dependencies F = {A B, B C, C D} is decomposed into {R1, R2}. The functional dependencies for R1 is F1={A B} and the functional dependency for R2 is F2 = {C D}. Is the decomposition R = {R1, R2} a loss-less join decomposition, Yes or No? Provide an explanation for your answer.

Database Systems CSE 5260 Fall 2006

Database Schema #1 Student (SS#, Student_Name, Street, City, State, ZIP) Offering (Department, Number, Section, Time, Location, Population) -- Courses currently offered for CSE 5260 department is CSE and number is 5260. Titles (Department, Number, Title) Enrollment (Student-name, Department, Number, Section)

Problem #1 (15 pts) Refer to Database Schema #1. Provide a SQL expression for each of the following. a) Provide the department, number, section, and title for every course section that has more than 25 students enrolled; i.e., the population > 25. c) Provide a list of student names that take the course Database. Sort the list in alphabetical order. d) Provide a list of student names and their Social Security Numbers that take the course Database in Section 3N. Problem #2 (25 pts) a) Define first normal form (1NF). b) Define second normal form (2NF). c) Define third normal form (3NF). d) Provide a formal definition for Functional Dependency Preservation. e) Define what is meant by a non-procedural query language? Give an example of a procedural and non-procedural query language.

Problem #3 (15 pts) Consider the following relational schemes for storing information associated with a hospital. Patient (SS#, name, policy#) Visit (SS#, date-admitted, time-admitted) Doctor (DrSS#, name, specialty) Log (SS#, DrSS#, test_type, date, result) Provide a relational algebra expression for each of the following. a) A list of the social security numbers for those patients who had a test for asthma on the same date that they were admitted. b) A list of the social security numbers for those patients who visited (admitted) the hospital on 01/01/05. c) A list of social security numbers for those patients that where admitted to the hospital on 01/01/05 and did not have an insurance policy.

Problem # 4 (15 pts) Create the Relational Database Tables for the Entity Relationship Diagram shown below. Underline the primary keys. The schema shows that a person can own and drive multiple vehicles and insure the vehicles under one insurance policy. The attribute # of Accidents, Cost, and Expiration Date applies to each car, which makes the relation schema Insurance a weak entity. Last Name First Name SS# Vehicle ID Type Make Person drives Vehicle Birth Date Age Gender Year Color Expiration Date Insurance # of Accidents Cost Policy Number

Problem # 5 (15 pts) Employee ( SS#, Project-Number, Last-Name, First-Name, Street, Zip, Project-Name, Project-Location) Address (Zip, City, County, State) Convert the database schema into 3rd Normal Form. Problem # 6 (15 pts) a) Provide an example of a loss-less join decomposition. Ensure you provide an adequate explanation for your example. b) Suppose a relation schema R is decomposed into {R1, R2}. What conditions must hold true to ensure the decomposition is loss-less. c) Suppose a relation schema R with functional dependencies F = {A B, B C, C D} is decomposed into {R1, R2}. The functional dependencies for R1 is F1={A B} and the functional dependency for R2 is F2 = {C D}. Is the decomposition R = {R1, R2} a loss-less join decomposition, Yes or No? Provide an explanation for your answer.

Database Systems CSE 5260 Fall 2008

Problem #1 a) Define first normal form (1NF). b) Define second normal form (2NF). c) Define third normal form (3NF). d) Define BCNF Problem #2 a) Provide a formal definition for Functional Dependency Preservation. b) Provide an example of a loss-less join decomposition. Ensure you provide an adequate explanation for your example. Problem #3 Define what is meant by a non-procedural query language? Give an example of a procedural and non-procedural query language. Problem #4 Under what circumstances would one consider using a file based system instead of a Database Management System (DBMS)?

Problem # 5 Create the Relational Database Tables for the Entity Relationship Diagram shown below. Underline the primary keys. The schema shows that a person can own and drive multiple vehicles and insure the vehicles under one insurance policy. The attribute # of Accidents, Cost, and Expiration Date applies to each car, which makes the relation schema Insurance a weak entity. Last Name First Name SS# Vehicle ID Type Make Person drives Vehicle Birth Date Age Gender Year Color Expiration Date Insurance # of Accidents Cost Policy Number