 Th ờ i gian thi: 90 phút  Hình th ứ c thi: lý thuy ế t (tr ắ c nghi ệ m + tr ả l ờ i ng ắ n) + bài t ậ p (đ ề m ở )  C ấ u trúc bài thi: ◦ A. Lý thuy.

Slides:



Advertisements
Similar presentations
Classwork notes. 2 Find the names of all employees whose salary greater than all managers salary.
Advertisements

COP4540 Database Management System Midterm Review
Chapter 5 Normalization of Database Tables
BACS 485—Database Management Advanced SQL Overview Advanced DDL, DML, and DCL Commands.
Database System - Assignment #3 Sept. 2012Yangjun Chen ACS Assignment #3 due Wed., Nov. 14, (30) Exercise 7.17 on Page 235 Show the result.
Chapter Three Objectives Identification of Keys Application of primary and foreign keys Converting a database design to Relational DB. What is a good DBMS.
PMIT-6102 Advanced Database Systems By- Jesmin Akhter Assistant Professor, IIT, Jahangirnagar University.
Normalization Dr. Mario Guimaraes. Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints.
Fall 2005 ICS184/EECS116 – Notes 08 1 ICS 184/EECS116: Introduction to Data Management Lecture Note 8 SQL: Structured Query Language -- DDL.
Functional Dependencies and Normalization for Relational Databases.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Normalization.
Overview Begin 6:00 Quiz15 mins6:15 Review Table Terms25 mins6:40 Short Break10 mins6:50 SQL: Creating Tables60 mins7:50 Break10 mins8:00 Lab – Creating.
Ms. Hatoon Al-Sagri CCIS – IS Department Normalization.
1 Normalization. 2 Normal Forms v If a relation is in a certain normal form (BCNF, 3NF etc.), it is known that certain kinds of redundancies are avoided/minimized.
Constraints We have discussed three types of integrity constraints: primary keys, not null constraints, and unique constraints. CREATE TABLE Movies ( title.
Copyright  Oracle Corporation, All rights reserved. 9 Manipulating Data: INSERT, UPDATE, DELETE.
SQL Exercises1 Revising RDB and SQL CTEC2902 Advanced Programming.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 6 NORMALIZATION FOR RELATIONAL DATABASES Instructor Ms. Arwa Binsaleh.
Week 6 Lecture Normalization
Functional Dependencies
o At the end of this lesson, you will be able to:  Describe the life-cycle development phases  Discuss the theoretical and physical aspects of a relational.
Slide 11-1 Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Revised by IB & SAM, Fasilkom UI, 2005 Exercise – T/F The columns of a.
Copyright  Oracle Corporation, All rights reserved. I Introduction.
Instructor :Huda Al-Omair
Creating a Table Create a table, “emp”, containing: –empno – a 4 digit employee number –ename – up to 10 character string –job – up to 9 character string.
4-1 Copyright  Oracle Corporation, All rights reserved. Data Manipulation Language (DML)
RELATIONAL ALGEBRA Relational Database Handout - 3.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Normalization for Relational Databases.
Dr. Philip Cannata 1 Programming Languages Prolog Part 3 SQL & Prolog.
1 Normalization, Roberts’s Rules and Introduction to Data Modeling CSCI 6442.
SQL (DDL & DML Commands)
Unit 6 Data Storage Design. Key Concepts 1. Database overview 2. SQL review 3. Designing fields 4. Denormalization 5. File organization 6. Object-relational.
1 ICS 184: Introduction to Data Management Lecture Note 11: Assertions, Triggers, and Index.
1 Information Retrieval and Use (IRU) CE An Introduction To SQL Part 1.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
By Abdul Rashid Ahmad. E.F. Codd proposed three normal forms: The first, second, and third normal forms 1NF, 2NF and 3NF are based on the functional dependencies.
Relational Database. Database Management System (DBMS)
Session 2: SQL (A): Parts 1 and 2 Original materials supplied by the Oracle Academic Initiative (OAI). Edited for classroom use by Professor Laku Chidambaram.
Chapter 3 Selected Single-Row Functions and Advanced DML & DDL.
Manipulating Data. Objectives After completing this lesson, you should be able to do the following: Describe each DML statement Insert rows into a table.
9 Manipulating Data. 9-2 Objectives At the end of this lesson, you should be able to: Describe each DML statement Insert rows into a table Update rows.
Copyright  Oracle Corporation, All rights reserved. 12 Creating Views.
COMP3030 Database Management System Final Review
An Introduction To SQL Part 2 (Special thanks to Geoff Leese)
1 Information Retrieval and Use (IRU) An Introduction To SQL Part 2.
9-1 © Prentice Hall, 2007 Topic 9: Physical Database Design Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Relational State Assertions These slides.
Introduction to Database Systems
Ch 7: Normalization-Part 1
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Collection Operators These slides are.
Copyright س Oracle Corporation, All rights reserved. 12 Creating Views.
DATA MODELING AND DATABASE DESIGN DATA MODELING AND DATABASE DESIGN Part 2.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Inner Joins These slides are licensed.
11-1 © Prentice Hall, 2004 Chapter 11: Physical Database Design Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Chapter 10_part3 Functional Dependencies and Normalization for Relational Databases.
CSCI N311: Oracle Database Programming 5-1 Chapter 15: Changing Data: insert, update, delete Insert Rollback Commit Update Delete Insert Statement –Allows.
Logical Database Design and Relational Data Model Muhammad Nasir
LECTURE TWO Introduction to Databases: Data models Relational database concepts Introduction to DDL & DML.
Advanced SQL. SQL - Nulls Nulls are not equal to anything - Null is not even equal to Null where columna != ‘ABC’ --this will not return records where.
Relational Normalization Theory
Manipulating Data Schedule: Timing Topic 40 minutes Lecture
Interacting with the Oracle Server
جملة الاستعلام الأساسية
Working with Composite Datatypes
What Is a View? EMPNO ENAME JOB EMP Table EMPVU10 View
Assignment#5 Normalization.
(SQL) Manipulating Data
Copyright © Ellis Cohen
Assignment#4 Normalization.
Presentation transcript:

 Th ờ i gian thi: 90 phút  Hình th ứ c thi: lý thuy ế t (tr ắ c nghi ệ m + tr ả l ờ i ng ắ n) + bài t ậ p (đ ề m ở )  C ấ u trúc bài thi: ◦ A. Lý thuy ế t t ổ ng h ợ p : 2.5đ ◦ B. Bài t ậ p : 7.5đ  Thi ế t k ế E(E)RD : 3đ  Ánh x ạ : 1đ  Vi ế t SQL : 1.5đ  B ả o m ậ t : 0.5đ  Chu ẩ n hóa, tìm khóa : 1.5đ

1. Given the below database schema

1. (cont.) a. Map this schema into ERD b. Write SQL statements to:  For each book that is loaned out from the "Sharpstown" branch and whose DueDate is today, retrieve the book title, the borrower's name, and the borrower's address.  For each library branch, retrieve the branch name and the total number of books loaned out from that branch  Retrieve the names, addresses, and number of books checked out for all borrowers who have more than five books checked out

 Given a relation Emp, the degree of the Emp relation is?  Given a relation SalGrade, the cardinality of the SalGrade relation is?  Given a relation Emp, a relation schema of the Emp relation is?  Given a relation Emp, is it possible to conclude that the Emp relation is in the first normal form?

 Given a relation Emp, which SQL statements are used in order to insert into the Emp relation the data about a new employee whose empno is 1234, ename is Tam, job is salesman, MGR is 7698, hire date is 15/07/1996, salary is 1800, and department is sales

a. Insert into EMP values(1234, ' Tam', ' salesman ', 7698, TO_DATE(' 15/07/1996', 'DD-MM-YYYY'), 1800, NULL,30); b. Insert into EMP values(1234, ' Tam', ' salesman ', 7698, TO_DATE(' 15/07/1996', 'DD-MM-YYYY'), 1800, NULL,(SELECT DEPNO FROM DEPT WHERE DNAME = ‘Sales”)); c. Insert into EMP (Empno, Ename, Job, MGR, HireDate, SAL, DepNo) values(1234, ' Tam', ' salesman ', 7698, TO_DATE(' 15/07/1996', 'DD- MM-YYYY'), 1800, 30); d. All a, b, and c are correct. e. None of them is correct.

 Given a relation Emp, which SQL statements are used in order to insert into the Emp relation the data about a new employee whose empno is 2345, ename is Tam, job is Manager, MGR is Null, hire date is 15/07/1996, salary is 1800, and department is human resource

a. Insert into EMP values(2345, ' Tam', ‘Manager ', NULL, TO_DATE(' 15/07/1996', 'DD-MM-YYYY'), 1800, NULL, NULL); b. Insert into EMP values(1234, ' Tam', ' salesman ', NULL, TO_DATE(' 15/07/1996', 'DD-MM-YYYY'), 1800, NULL,(SELECT DEPNO FROM DEPT WHERE DNAME = ‘human resource”)); c. All a, b are correct. d. Both a and b are unable to be used for that insertion because there is no data about the deparment of human resource in the Dept relation and the foreign key constraint is therefore violated.

3. Consider this database with the following functional depencies (primary key is (FactoryNumber, ProductNumber) and candidate key is (FactoryName, ProductNumber)) Production (FactoryNumber, FactoryName, ProductNumber, Status, Location, QtyOnDay)  FactoryNumber  FactoryName  FactoryNumber  Status  Status  Location  Location  Status  FactoryNumber, ProductNumber  QtyOnDay  FactoryName, ProductNumber  QtyOnDay

 Given database with its relation Production as shown above, which normal form is the Production relation in? a. First normal form b. Second normal form c. Third normal form d. Boyce-Codd normal form  Can you normalize it into the highest level?

Consider the relation R, which has attributes that hold schedules of courses and sections at a university. R = {CourseNo, SecNo, OfferingDept,CreditHours, CourseLevel, InstructorSSN,Semester, Year, Days_Hours, RoomNo,NoOfStudents} Suppose that the following functional dependencies hold on R:  {CourseNo} -> {OfferingDept, CreditHours,CourseLevel}  {CourseNo, SecNo, Semester, Year} ->{Days_Hours, RoomNo, NoOfStudents,InstructorSSN}  {RoomNo, Days_Hours, Semester, Year} -> {InstructorSSN, CourseNo, SecNo}  Try to determine which sets of attributes form keys of R. How would you normalize this relation?

Consider the following relation for published books: BOOK (Book_title, Authorname, Book type Book_type, Listprice, Author_affil,Publisher) Author_affil referes to the affiliation of the author Suppose the following dependencies exist:  Book_title -> Publisher, Book_type  Book Book_type -> Listprice  Author_name -> Author-affil Find keys and normalize this relation into 3NF