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

Save this PDF as:

Size: px
Start display at page:

## Transcription

5 Return the model of those cars, for which all cars of that model have been involved in an accident (e.g. If every car of model TOYOTA has been involved in an accident, the query must return the model TOYOTA. If there is one TOYOTA car not involved in an accident, TOYOTA should NOT be returned by the query) II. External Sorting (10 points) 1. (6 points) Suppose we wish to sort the following values: 84, 22, 19, 11, 60, 68, 31, 29, 58, 23, 45, 93, 48, 31, 7 Assume that: you have three pages of memory for sorting you will use an external sorting algorithm with a 2-way merge a page only holds two values For each sorting pass, show the contents of all temporary files. 84, 22 19, 11 60, 68 31, 29 58, 23 45, 93 48, , 84 11, 19 60, 68 29, 31 23, 58 45, 93 31, , 19 22, 84 29, 31 60, 68 23, 45 58, 93 7, , 19 22, 29 31, 60 68, 84 7, 23 31, 45 48, , 11 19, 22 23, 29 31, 31 45, 48 58, 60 68, (2 points) If you have 100 pages of data, and 10 pages of memory, what is the minimum number of passes required to sort the data. Num passes = 1 + log B-1 N/B = 1 + log 9 100/10 = 1 + log 9 10 = = 3 3. (2 points) If you have 500,000 pages of data, what is the minimum number of pages of memory required to sort the data in 3 passes? 4 Points for this page:

6 Num passes = 1 + log B-1 N/B = 3 so, log B-1 N/B = 2 N/B (B 1) 2 N B(B 1) 2 B = 81 You can also simplify this to N B 3, in which case B = 80. III. Join Algorithms (6 points) Consider a relation R with attributes (x,y) and a relation S with attributes (y, z). Column y in S is a key and the set of values of y in R are the same as the set of values of y in S. Assume that there are no indexes available and that there are 25 pages in the buffer available. Table R is 1,500 pages with 50 tuples per page. Table S is 400 with 100 tuples per page. Compute the I/O costs for the following joins. Assume the simplest cost model, where pages are read and written one at a time. A. Block nested loops join with R as the outer relation and S as the inner relation R + R /B S = / = or R + R /B-1 S = / = or R + R /B-2 S = / = Since all three equations were given in class, any were acceptable. B. Block nested loops join with S as the outer relation and R as the inner relation S + S /B R = / = or S + S /B-1 R = / = or S + S /B-2 R = / = C. Sort merge join with R as the outer relation and S as the inner relation 2 R (1 + log B-1 R /B ) + 2 S (1 + log B-1 S /B ) + R + S = 2(1500)(1+ log /25 ) + 2(400)(1+ log /25 ) = We cannot use the cost model of 3(M+N) because we cannot sort the larger of the two relations in 2 passes. D. Sort merge join with S as the outer relation and R as the inner relation Same as part (c) E. Hash join with S as the outer relation and R as the inner relation 3( R + S ) = 3( ) = Points for this page:

7 IV Query Optimization Consider the following schema Sailors(sid, sname, rating, age) Reserves(sid, did, day) Boats(bid, bname, size) Reserves.sid is a foreign key to Sailors and Reserves.bid is a foreign key to Boats.bid. We are given the following information about the database: Reserves contains 10,000 records with 40 records per page. Sailors contains 1000 records with 20 records per page. Boats contains 100 records with 10 records per page. There are 50 values for Reserves.bid. There are 10 values for Sailors.rating (1...10) There are 10 values for Boat.size There are 500 values for Reserves.day Consider the following query SELECT S.sid, S.sname, B.bname FROM Sailors S, Reserves R, Boats B WHERE S.sid = R.sid AND R.bid = B.bid AND B.size > 5 AND R.day = 'July 4, 2003'; (a) Assuming uniform distribution of values and column independence, estimate the number of tuples returned by this query. The maximum cardinality this query is R S B = Reduction Factors: 1/2 for B.size > 5, 1/500 for R.day = July 4, 2003, 1/100 for R.bid = B.bid, and 1/1000 for S.sid = R/sid So number of tuples return is (1/2)(1/500)(1/100)(1/1000)(10 9 ) = 10 Consider the following query SELECT S.sid, S.sname, B.bname FROM Sailors S, Reserves R, Boats B WHERE S.sid = R.sid AND R.bid = B.bid (b) Draw all possible left-deep query plans for this query: Note that we cannot join S and B since that would result in a cross product. 6 Points for this page:

8 (c) For the first join in each query plan (the one at the bottom of the tree, what join algorithm would work best? Assume that you have 50 pages of memory. There are no indexes, so indexed nested loops is not an option. R = 250, S = 50, B = 10. R join S: Page-oriented nested loops join: R + R S = = Block nested loops join: R + R /49 S = = 550 Sort-merge join: note that 250 < (num buffers) 2 so cost is 3( R + S ) = 3(250+50) = 900 Hash join: we can use hash join since each of the R partitions from phase one fit into memory. So cost is 3( R + S ) = 3(250+50) = 900. Cheapest: Block nested loops S join R: Page-oriented nest loops join: S + S R = = Block nested loops join: S + S /49 R = = 550 Sort-merge join: 3( R + S ) = 3(250+50) = 900 Hash join: 3( R + S ) = 3(250+50) = 900 Cheapest: Block nested loops B join R: Page-oriented nested loops: B + B R = = 2510 Block nested loops join: B + B /49 R = = 260 Sort-merge join: 3(10+250) = 780 Hash join: 3(10+250) = 780 Cheapest: Block nested loops R join B: Page-oriented nested loops join: The thing to note is that we can fit the entire Boats relation into memory, so we only need to scan Boats once. So the cost is R + B = 260. This is the same if we use simple nested loops join. Block nested loops join: R + R /49 B = = 310 Sort merge join: 3(10+250) = 900 Hash join: 3(10+250) = 900 Cheapest: Page-oriented nested loops, or simple nested loops 7 Points for this page:

10 VI. Functional Dependencies and Normalization (20 points total) Consider the attributes A B C D E F G which have the following functional dependencies: AD F AE G DF BC E C G E 1. List all candidate keys (not superkeys): (5 points) A D E A D G 2. Which of the following dependencies are implied by those above: (5 points) a. (IS) (IS NOT) G C b. (IS) (IS NOT) A G c. (IS) (IS NOT) ADF E d. (IS) (IS NOT) ADC B e. (IS) (IS NOT) AGF E 3. Consider the decomposition into 4 relations: (ADF) (CE) (EG) (ABDG). This decomposition: (5 points) a. (IS) (IS NOT) in BCNF b. (IS) (IS NOT) in 3NF c. (IS) (IS NOT) in 1NF d. (IS) (IS NOT) Dependency Preserving e. (IS) (IS NOT) Lossless 4. Consider the decomposition into 3 relations: (ADF) (EC) (ABDEG). This decomposition: (5 points) a. (IS) (IS NOT) in BCNF b. (IS) (IS NOT) in 3NF c. (IS) (IS NOT) 1NF d. (IS) (IS NOT) Dependency Preserving e. (IS) (IS NOT) Lossless 9 Points for this page:

11 VII. Entity-Relational Model (20 Points) a) (10 points) Draw an E-R diagram for the following situation: This is a simplified model for reserving baseball tickets. There are teams, which are identified by the team name. Teams are also located in a city. Teams play each other in games, which occur on a particular date at a particular time. Games are identified by a game ID, and each game has exactly two teams that play in it. A game is played in exactly one stadium. A stadium is identified by its name, and is also located in a city. Stadiums have seats, which have a section number, a row number, and a seat number. Ticket holders reserve seats for a game. Ticket holders are identified by their name. Some ticket holders are students (students get discounts, but we are not including that in the model). 10 Points for this page:

12 b) (10 points) Using SQL, convert the following ER diagram to the relational model. Hint: You do not need CHECK constraints. CREATE TABLE Player (name char(30), salary real, tname char(30) NOT NULL, PRIMARY KEY (name), FOREIGN KEY (tname) REFERENCES Team); CREATE TABLE Team (tname char(30), city char(30), PRIMARY KEY (tname)); CREATE TABLE Manager (mname char(30), salary real, tname char(30) NOT NULL, PRIMARY KEY (mname), FOREIGN KEY (tname) REFERENCES Team); CREATE TABLE AAATeam (tname char(30), aname char(30), city char(30), PRIMARY KEY (tname, aname), FOREIGN KEY (tname) REFERENCES Team); 11 Points for this page:

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

Tutorial 5: SQL By Chaofa Gao Tables used in this note: Sailors(sid: integer, sname: string, rating: integer, age: real); Boats(bid: integer, bname: string, color: string); Reserves(sid: integer, bid:

### Chapter 5. SQL: Queries, Constraints, Triggers

Chapter 5 SQL: Queries, Constraints, Triggers 1 Overview: aspects of SQL DML: Data Management Language. Pose queries (Ch. 5) and insert, delete, modify rows (Ch. 3) DDL: Data Definition Language. Creation,

### Query Optimization Example. Steps Query op5miza5on steps: 12/13/09

Query Optimization Example (sid, sname, ra5ng, age) (bid, bname, color) (sid, bid, day, rname) Query: SELECT S.sid, S.sname, S.age FROM S, B, R WHERE B.bid = R.rid AND B.bid = R.bid AND B.color = Red AND

### CSE 444 Practice Problems. Query Optimization

CSE 444 Practice Problems Query Optimization 1. Query Optimization Given the following SQL query: Student (sid, name, age, address) Book(bid, title, author) Checkout(sid, bid, date) SELECT S.name FROM

### Q4. What are data model? Explain the different data model with examples. Q8. Differentiate physical and logical data independence data models.

FAQs Introduction to Database Systems and Design Module 1: Introduction Data, Database, DBMS, DBA Q2. What is a catalogue? Explain the use of it in DBMS. Q3. Differentiate File System approach and Database

### 8. Query Processing. Query Processing & Optimization

ECS-165A WQ 11 136 8. Query Processing Goals: Understand the basic concepts underlying the steps in query processing and optimization and estimating query processing cost; apply query optimization techniques;

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

EXAMINATIONS 2005 MID-YEAR COMP 302 Database Systems Time allowed: Instructions: 3 Hours Answer all questions. Make sure that your answers are clear and to the point. Write your answers in the spaces provided.

### Homework 3: Normalization, Indexing SOLUTION. AB C ; D B ; AC D. Answer each question below and carefully justify your answer.

CS 461, Database Systems, Spring 2015 Problem 1 (25pts): Normalization Homework 3: Normalization, Indexing SOLUTION Consider relation R (ABCD) together with the following set of FDs: AB C ; D B ; AC D.

### OVERVIEW OF QUERY EVALUATION

12 OVERVIEW OF QUERY EVALUATION Exercise 12.1 Briefly answer the following questions: 1. Describe three techniques commonly used when developing algorithms for relational operators. Explain how these techniques

### SQL: Queries, Programming, Triggers

SQL: Queries, Programming, Triggers Chapter 5 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 R1 Example Instances We will use these instances of the Sailors and Reserves relations in

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

SQL: Queries, Programming, Triggers Chapter 5 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Example Instances We will use these instances of the Sailors and Reserves relations in our

### 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

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

### ICS 434 Advanced Database Systems

ICS 434 Advanced Database Systems Dr. Abdallah Al-Sukairi sukairi@kfupm.edu.sa Second Semester 2003-2004 (032) King Fahd University of Petroleum & Minerals Information & Computer Science Department Outline

### Plan for the Query Optimization topic

VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui COMP302 Database Systems Plan for the Query Optimization topic COMP302 Database Systems Query Optimisation_04 1 What is Query

### Query Processing + Optimization: Outline

Query Processing + Optimization: Outline Operator Evaluation Strategies Query processing in general Selection Join Query Optimization Heuristic query optimization Cost-based query optimization Query Tuning

### SQL: Queries, Programming, Triggers

SQL: Queries, Programming, Triggers CSC343 Introduction to Databases - A. Vaisman 1 R1 Example Instances We will use these instances of the Sailors and Reserves relations in our examples. If the key for

### Query Processing C H A P T E R12. Practice Exercises

C H A P T E R12 Query Processing Practice Exercises 12.1 Assume (for simplicity in this exercise) that only one tuple fits in a block and memory holds at most 3 blocks. Show the runs created on each pass

### Kathleen Durant PhD Lecture 19 CS 3200 Northeastern University. Slide Content Courtesy of R. Ramakrishnan, J. Gehrke, and J.

Relational Query Optimization Kathleen Durant PhD Lecture 19 CS 3200 Northeastern University 1 Slide Content Courtesy of R. Ramakrishnan, J. Gehrke, and J. Hellerstein Overview of Query Evaluation Query

### Exercise 1: Relational Model

Exercise 1: Relational Model 1. Consider the relational database of next relational schema with 3 relations. What are the best possible primary keys in each relation? employ(person_name, street, city)

### Comp 5311 Database Management Systems. 16. Review 2 (Physical Level)

Comp 5311 Database Management Systems 16. Review 2 (Physical Level) 1 Main Topics Indexing Join Algorithms Query Processing and Optimization Transactions and Concurrency Control 2 Indexing Used for faster

### Elena Baralis, Silvia Chiusano Politecnico di Torino. Pag. 1. Physical Design. Phases of database design. Physical design: Inputs.

Phases of database design Application requirements Conceptual design Database Management Systems Conceptual schema Logical design ER or UML Physical Design Relational tables Logical schema Physical design

### www.gr8ambitionz.com

Data Base Management Systems (DBMS) Study Material (Objective Type questions with Answers) Shared by Akhil Arora Powered by www. your A to Z competitive exam guide Database Objective type questions Q.1

### Lecture 6: Query optimization, query tuning. Rasmus Pagh

Lecture 6: Query optimization, query tuning Rasmus Pagh 1 Today s lecture Only one session (10-13) Query optimization: Overview of query evaluation Estimating sizes of intermediate results A typical query

### Query Optimization. Query Optimization. Optimization considerations. Example. Interaction of algorithm choice and tree arrangement.

COS 597: Principles of Database and Information Systems Query Optimization Query Optimization Query as expression over relational algebraic operations Get evaluation (parse) tree Leaves: base relations

### Relational Algebra and SQL

Relational Algebra and SQL Johannes Gehrke johannes@cs.cornell.edu http://www.cs.cornell.edu/johannes Slides from Database Management Systems, 3 rd Edition, Ramakrishnan and Gehrke. Database Management

### a. Write a query to generate the number of charter flights to the same destination and shows the results in alphabetic order.

CS 631 _ DBMS Sample Final Exam Questions Question #1: Using the data given in the AviaCo database, perform the following queries and show the expected results: a. Write a query to generate the number

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

Databases -Normalization III (N Spadaccini 2010 and W Liu 2012) Databases - Normalization III 1 / 31 This lecture This lecture describes 3rd normal form. (N Spadaccini 2010 and W Liu 2012) Databases -

### Storage and File Structure

Storage and File Structure Chapter 10: Storage and File Structure Overview of Physical Storage Media Magnetic Disks RAID Tertiary Storage Storage Access File Organization Organization of Records in Files

### Lecture 1: Data Storage & Index

Lecture 1: Data Storage & Index R&G Chapter 8-11 Concurrency control Query Execution and Optimization Relational Operators File & Access Methods Buffer Management Disk Space Management Recovery Manager

### ! Overview! Measures of Query Cost! Selection Operation! Sorting! Join Operation! Other Operations! Evaluation of Expressions

Chapter 13: Query Processing Chapter 13: Query Processing! Overview! Measures of Query Cost! Selection Operation! Sorting! Join Operation! Other Operations! Evaluation of Expressions Basic Steps in Query

### QUERIES, PROGRAMMING, TRIGGERS

5 SQL: QUERIES, PROGRAMMING, TRIGGERS What men or gods are these? What maidens loth? What mad pursuit? What struggle to escape? What pipes and timbrels? What wild ecstasy? What is the average salary in

### Database Sample Examination

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

### GROUP BY and HAVING. SELECT MIN (S.age) FROM Sailors S WHERE S.rating = i. For i = 1, 2,..., 10:

SQL - 4 Week 9 GROUP BY and HAVING So far, we ve applied aggregate operators to all (qualifying) tuples. Sometimes, we want to apply them to each of several groups of tuples. Consider: Find the age of

### CISC437/637 Database Systems Midterm Exam

CISC437/637 Database Systems Midterm Exam You have from 2:00 to 3:15pm to complete the following questions. Use the back of the page if you need more space. Good luck! Multiple Choice (2 point each; 40

### Databases and BigData

Eduardo Cunha de Almeida eduardo.almeida@uni.lu Outline of the course Introduction Database Systems (E. Almeida) Distributed Hash Tables and P2P (C. Cassagnes) NewSQL (D. Kim and J. Meira) NoSQL (D. Kim)

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

6.830 Lecture 3 9.16.2015 PS1 Due Next Time (Tuesday!) Lab 1 Out today start early! Relational Model Continued, and Schema Design and Normalization Animals(name,age,species,cageno,keptby,feedtime) Keeper(id,name)

### BCA. Database Management System

BCA IV Sem Database Management System Multiple choice questions 1. A Database Management System (DBMS) is A. Collection of interrelated data B. Collection of programs to access data C. Collection of data

### Introduction to SQL C H A P T E R3. Exercises

C H A P T E R3 Introduction to SQL Exercises 3.1 Write the following queries in SQL, using the university schema. (We suggest you actually run these queries on a database, using the sample data that we

### SQL Query Evaluation. Winter 2006-2007 Lecture 23

SQL Query Evaluation Winter 2006-2007 Lecture 23 SQL Query Processing Databases go through three steps: Parse SQL into an execution plan Optimize the execution plan Evaluate the optimized plan Execution

### Chapter 13: Query Processing. Basic Steps in Query Processing

Chapter 13: Query Processing! Overview! Measures of Query Cost! Selection Operation! Sorting! Join Operation! Other Operations! Evaluation of Expressions 13.1 Basic Steps in Query Processing 1. Parsing

### Query Processing, optimization, and indexing techniques

Query Processing, optimization, and indexing techniques What s s this tutorial about? From here: SELECT C.name AS Course, count(s.students) AS Cnt FROM courses C, subscription S WHERE C.lecturer = Calders

### SQL. Solutions to Practice Exercises

C H A P T E R 3 SQL Solutions to Practice Exercises 3.1 Note: The participated relation relates drivers, cars, and accidents. a. Note: this is not the same as the total number of accidents in 1989. We

### G.H. Raisoni College of Engineering & Management, Amravati. Question Bank (DBMS) Third Year CSE

G.H. Raisoni College of Engineering & Management, Amravati. Question Bank (DBMS) Third Year CSE UNIT 1 Q.1. Explain the three levels of data abstraction. Q.2. What are the advantages and disadvantages

### 10. What SQL command can be used to add columns to a table? a. MODIFY TABLE TableName ADD COLUMN ColumnName b. MODIFY TABLE TableName ADD ColumnName c

1. The first generation of DBMS is represented by systems a. Hierarchical and CODASYL systems. b. Relational model c. Network model 2. Which of the following SQL statements are helpful in database redesign?

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

Limitations of E-R Designs Relational Normalization Theory Chapter 6 Provides a set of guidelines, does not result in a unique database schema Does not provide a way of evaluating alternative schemas Normalization

### Storage and Indexing. DBS Database Systems Implementing and Optimising Query Languages. Differences between disk and main memory

DBS Database Systems Implementing and Optimising Query Languages Peter Buneman 9 November 2010 Reading: R&G Chapters 8, 9 & 10.1 Storage and Indexing We typically store data in external (secondary) storage.

### Figure 4.12.Insurancedatabase.

Exercises 43 person (driver-id, name, address) car (license, model, year) accident (report-number, date, location) owns (driver-id, license) participated (driver-id, car, report-number, damage-amount)

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

LiTH, Tekniska högskolan vid Linköpings universitet 1(7) IDA, Institutionen för datavetenskap Juha Takkinen 2007-05-24 1. A database schema is a. the state of the db b. a description of the db using a

### 2. Find all sailor id s of sailors who have a rating of at least 8 or reserved boat 103.

Exercises on SQL Try to solve as many problems as possible. You are not expected to complete this in one tutorial. Go over these exercises before you attend your tutorial. For each exercise, try it first

### Storing Data: Disks and Files

Storing Data: Disks and Files [R&G] Chapter 9 CS 4320 1 Data on External Storage Disks: Can retrieve random page at fixed cost But reading several consecutive pages is much cheaper than reading them in

### Introduction to Databases

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

### Lecture Notes on Database Normalization

Lecture Notes on Database Normalization Chengkai Li Department of Computer Science and Engineering The University of Texas at Arlington April 15, 2012 I decided to write this document, because many students

### Relational Model CENG 351 1

Relational Model CENG 351 1 Relational Database: Definitions Relational database: a set of relations Relation: made up of 2 parts: Instance : a table, with rows and columns. #Rows = cardinality, #fields

### arm DBMS File Organization, Indexes 1. Basics of Hard Disks

DBMS File Organization, Indexes 1. Basics of Hard Disks All data in a DB is stored on hard disks (HD). In fact, all files and the way they are organised (e.g. the familiar tree of folders and sub-folders

### Functional Dependencies and Normalization

Functional Dependencies and Normalization 5DV119 Introduction to Database Management Umeå University Department of Computing Science Stephen J. Hegner hegner@cs.umu.se http://www.cs.umu.se/~hegner Functional

### Intermezzo: A typical database architecture

Intermezzo: A typical database architecture 136 SQL SQL SQL SQL SQL Query Evaluation Engine Parser Optimizer Physical operators Transaction Manager Lock Manager Concurrency control File & Access Methods

### D B M G Data Base and Data Mining Group of Politecnico di Torino

Database Management Data Base and Data Mining Group of tania.cerquitelli@polito.it A.A. 2014-2015 Optimizer objective A SQL statement can be executed in many different ways The query optimizer determines

### There are five fields or columns, with names and types as shown above.

3 THE RELATIONAL MODEL Exercise 3.1 Define the following terms: relation schema, relational database schema, domain, attribute, attribute domain, relation instance, relation cardinality, andrelation degree.

### CIS 631 Database Management Systems Sample Final Exam

CIS 631 Database Management Systems Sample Final Exam 1. (25 points) Match the items from the left column with those in the right and place the letters in the empty slots. k 1. Single-level index files

### Relational Algebra. CSE 544: Relational Operators, Sorting. What about Intersection? 1. Union and 2. Difference. 4. Projection. 3.

Relational Algebra CSE 544: Relational Operators, Sorting Wednesday, 5/12/2004 Operates on relations, i.e. sets Later: we discuss how to extend this to bags Five operators: Union: Difference: - Selection:

### Databases What the Specification Says

Databases What the Specification Says Describe flat files and relational databases, explaining the differences between them; Design a simple relational database to the third normal form (3NF), using entityrelationship

### University of Massachusetts Amherst Department of Computer Science Prof. Yanlei Diao

University of Massachusetts Amherst Department of Computer Science Prof. Yanlei Diao CMPSCI 445 Midterm Practice Questions NAME: LOGIN: Write all of your answers directly on this paper. Be sure to clearly

### SOLUTIONS SOLUTIONS SOLUTIONS SOLUTIONS

York University Test 1 / Fall 2008 Department of Computer Science and Engineering CSE3421 This is a closed book, 40 minutes test No questions are allowed during the test. If in doubt, write down your doubts

### Storage in Database Systems. CMPSCI 445 Fall 2010

Storage in Database Systems CMPSCI 445 Fall 2010 1 Storage Topics Architecture and Overview Disks Buffer management Files of records 2 DBMS Architecture Query Parser Query Rewriter Query Optimizer Query

### DATABASE NORMALIZATION

DATABASE NORMALIZATION Normalization: process of efficiently organizing data in the DB. RELATIONS (attributes grouped together) Accurate representation of data, relationships and constraints. Goal: - Eliminate

### LOGICAL DATABASE DESIGN

MODULE 8 LOGICAL DATABASE DESIGN OBJECTIVE QUESTIONS There are 4 alternative answers to each question. One of them is correct. Pick the correct answer. Do not guess. A key is given at the end of the module

### Performance Tuning for the Teradata Database

Performance Tuning for the Teradata Database Matthew W Froemsdorf Teradata Partner Engineering and Technical Consulting - i - Document Changes Rev. Date Section Comment 1.0 2010-10-26 All Initial document

### Schema Design and Normal Forms Sid Name Level Rating Wage Hours

Entity-Relationship Diagram Schema Design and Sid Name Level Rating Wage Hours Database Management Systems, 2 nd Edition. R. Ramakrishnan and J. Gehrke 1 Database Management Systems, 2 nd Edition. R. Ramakrishnan

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

DBS Database Systems Designing Relational Databases Peter Buneman 12 October 2010 SQL DDL In its simplest use, SQL s Data Definition Language (DDL) provides a name and a type for each column of a table.

### Proposed solutions Project Assignment #1 (SQL)

Proposed solutions Project Assignment #1 (SQL) (a) Database creation: create table sailor (sname CHAR(30), rating INTEGER) create table boat (bname CHAR (30), color CHAR (15), rating INTEGER) create table

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

Part I: Entity Relationship Diagrams and SQL (40/100 Pt.) Q.1.1) Translate the following E-R Schema to SQL-DDL tables using the CREATE Table Statement and check constraints, if needed: LatinName EnglishName

### Dr. Rafiq Zakaria Campus. Maulana Azad College of Arts, Science & commerce, Aurangabad. Department of Computer Science. Academic Year

Dr. Rafiq Zakaria Campus Maulana Azad College of Arts, Science & commerce, Aurangabad Department of Computer Science Academic Year 2015-16 MCQs on Database Management System Using SQL Sem. :- IV Q.1 DBMS

### 10CS54: DATABASE MANAGEMENT SYSTEM

CS54: DATABASE MANAGEMENT SYSTEM QUESTION BANK Chapter 1: Introduction to Database Systems Objective: Databases and data base system have become an essential component of everyday life in modern society.

### Inside the PostgreSQL Query Optimizer

Inside the PostgreSQL Query Optimizer Neil Conway neilc@samurai.com Fujitsu Australia Software Technology PostgreSQL Query Optimizer Internals p. 1 Outline Introduction to query optimization Outline of

### Datenbanksysteme II: Implementation of Database Systems Implementing Joins

Datenbanksysteme II: Implementation of Database Systems Implementing Joins Material von Prof. Johann Christoph Freytag Prof. Kai-Uwe Sattler Prof. Alfons Kemper, Dr. Eickler Prof. Hector Garcia-Molina

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

DBMS Questions 1.) Which type of file is part of the Oracle database? A.) B.) C.) D.) Control file Password file Parameter files Archived log files 2.) Which statements are use to UNLOCK the user? A.)

### Lecture 6. SQL, Logical DB Design

Lecture 6 SQL, Logical DB Design Relational Query Languages A major strength of the relational model: supports simple, powerful querying of data. Queries can be written intuitively, and the DBMS is responsible

### Normalization in Database Design

in Database Design Marek Rychly mrychly@strathmore.edu Strathmore University, @ilabafrica & Brno University of Technology, Faculty of Information Technology Advanced Databases and Enterprise Systems 14

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

Week 11: Normal Forms Database Design Database Redundancies and Anomalies Functional Dependencies Entailment, Closure and Equivalence Lossless Decompositions The Third Normal Form (3NF) The Boyce-Codd

### CSCI-GA.2433-001 Database Systems Lecture 7: Schema Refinement and Normalization

CSCI-GA.2433-001 Database Systems Lecture 7: Schema Refinement and Normalization Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com View 1 View 2 View 3 Conceptual Schema At that point we

### Normal Form for Sets of Nested Relations

Normal Form for Sets of 1. Background 2. A Norm Form for sets of nested relations (NF - nested relations) 3. A Decomposition method for NF-nested relations design 4. NF - nested relation schema Design

### Storing Data: Disks and Files

Storing : Disks and Files Chapter 7 base Management Systems, R. Ramakrishnan and J. Gehrke 1 Disks and Files DBMS stores information on ( hard ) disks. This has major implications for DBMS implementation!

### Database Management System

Database Management System Normalization (Unit - IV) NORMALIZATION While designing a database out of an entity relationship model, the main problem existing in that raw database is redundancy. Redundancy

### 1. Given the relation schema R = (A, B, C, D, E) and the canonical cover of its set of functional dependencies

Database Design Practice Questions Solution 1. Given the relation schema R = (A, B, C, D, E) and the canonical cover of its set of functional dependencies F c = { A BC CD E B D E A } Compute a lossless

### COMP 378 Database Systems Notes for Chapter 7 of Database System Concepts Database Design and the Entity-Relationship Model

COMP 378 Database Systems Notes for Chapter 7 of Database System Concepts Database Design and the Entity-Relationship Model The entity-relationship (E-R) model is a a data model in which information stored

### Database Management Systems. Redundancy and Other Problems. Redundancy

Database Management Systems Winter 2004 CMPUT 391: Database Design Theory or Relational Normalization Theory Dr. Osmar R. Zaïane Lecture 2 Limitations of Relational Database Designs Provides a set of guidelines,

### Physical Database Design and Tuning

Chapter 20 Physical Database Design and Tuning Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1. Physical Database Design in Relational Databases (1) Factors that Influence

### 6. Storage and File Structures

ECS-165A WQ 11 110 6. Storage and File Structures Goals Understand the basic concepts underlying different storage media, buffer management, files structures, and organization of records in files. Contents

### The Relational Model. Ramakrishnan&Gehrke, Chapter 3 CS4320 1

The Relational Model Ramakrishnan&Gehrke, Chapter 3 CS4320 1 Why Study the Relational Model? Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. Legacy systems in older models

### DBMS Interview Questions

DBMS Interview Questions 1. What is database? A database is a collection of information that is organized. So that it can easily be accessed, managed, and updated. 2. What is DBMS? DBMS stands for Database

### Why Query Optimization? Access Path Selection in a Relational Database Management System. How to come up with the right query plan?

Why Query Optimization? Access Path Selection in a Relational Database Management System P. Selinger, M. Astrahan, D. Chamberlin, R. Lorie, T. Price Peyman Talebifard Queries must be executed and execution

Chapter 20 Physical Database Design and Tuning Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1. Physical Database Design in Relational Databases (1) Factors that Influence

### Chapter 6: Physical Database Design and Performance. Database Development Process. Physical Design Process. Physical Database Design

Chapter 6: Physical Database Design and Performance Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R. McFadden Robert C. Nickerson ISYS 464 Spring 2003 Topic 23 Database

### 6 QUERY-BY-EXAMPLE (QBE)

6 QUERY-BY-EXAMPLE (QBE) Example is always more efficacious than precept. Samuel Johnson 6.1 INTRODUCTION Query-by-Example (QBE) is another language for querying (and, like SQL, for creating and modifying)

### COSC-3421 Midterm Test w/ answers

Winter 2005 COSC-3421 Midterm Test w/ answers p. 1 of 16 COSC-3421 Midterm Test w/ answers Family Name: Given Name: Instructor: Parke Godfrey Exam Duration: 75 minutes Term: Winter 2005 Your assignment,

### Storing Data: Disks and Files

Storing Data: Disks and Files Chapter 7 Yea, from the table of my memory I ll wipe away all trivial fond records. -- Shakespeare, Hamlet Database Management Systems, R. Ramakrishnan and J. Gehrke 1 Disks

### 2. Conceptual Modeling using the Entity-Relationship Model

ECS-165A WQ 11 15 Contents 2. Conceptual Modeling using the Entity-Relationship Model Basic concepts: entities and entity types, attributes and keys, relationships and relationship types Entity-Relationship

### Functional Dependencies and Finding a Minimal Cover

Functional Dependencies and Finding a Minimal Cover Robert Soulé 1 Normalization An anomaly occurs in a database when you can update, insert, or delete data, and get undesired side-effects. These side