King Fahd University of Petroleum and Minerals

Similar documents
CS2 Current Technologies Lecture 2: SQL Programming Basics

CS2 Current Technologies Lecture 3: SQL - Joins and Subqueries

CS2 Current Technologies Note 1 CS2Bh

Real-World Performance Training SQL Introduction

Department of Computer Science and Information Systems, College of Business and Technology, Morehead State University

Part III. Data Modelling. Marc H. Scholl (DBIS, Uni KN) Information Management Winter 2007/08 1

Programming Languages

Database Management System. * First install Mysql Database or Wamp Server which contains Mysql Databse.

Introduction. Introduction to Oracle: SQL and PL/SQL

Informatics Practices (065) Sample Question Paper 1 Section A

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement

Pivot Tables Motivation (1)

Database implementation Further SQL

Table : Purchase. Field DataType Size Constraints CustID CHAR 5 Primary key CustName Varchar 30 ItemName Varchar 30 PurchaseDate Date

Introduc.on to Databases

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

Databases. Relational Model, Algebra and operations. How do we model and manipulate complex data structures inside a computer system? Until

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

SQL. Char (30) can store ram, ramji007 or 80- b

CS Reading Packet: "Writing relational operations using SQL"

1 SQL Structured Query Language

1 SQL Structured Query Language

Database Systems Relational Model. A.R. Hurson 323 CS Building

Q5 Question Based on SQL & Database Concept Total Marks 8. Theory Question 2 Marks / SQL Commands 6 Marks / Output of commands 2 Marks

Chapter 4. The Relational Model

SQL Structured Query Language Introduction

Creating and Managing Tables Schedule: Timing Topic

VU Mobile Powered by S NO Group All Rights Reserved S NO Group 2013

Databases 1. Daniel POP

RDBMS Using Oracle. BIT-4 Lecture Week 3. Lecture Overview

Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Slide 17-1

Databases - 4. Other relational operations and DDL. How to write RA expressions for dummies

Data about data is database Select correct option: True False Partially True None of the Above

KENDRIYA VIDYALAYA ALIGANJ SHIFT-II HOLIDAY HOMEWORK CLASS-XII INFORMATICS PRACTICES

CS Reading Packet: "Views, and Simple Reports - Part 1"

The Relational Model Constraints and SQL DDL

The Relational Model

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

Introduction to Relational Database Concepts. Copyright 2011, Oracle. All rights reserved.

Relational Database Management Systems Oct I. Section-A: 5 X 4 =20 Marks

ajpatelit.wordpress.com

: ADMINISTRATION I EXAM OBJECTIVES COVERED IN THIS CHAPTER:

8) A top-to-bottom relationship among the items in a database is established by a

Topic 8 Structured Query Language (SQL) : DML Part 2

EGCI 321: Database Systems. Dr. Tanasanee Phienthrakul

KINGDOM OF SAUDI ARABIA-JAZAN UNIVERSITY COLLEGE OF COMPUTER SCIENCE & INFORMATION SYSTEMS 221 INFS 3 DATABASE SYSTEMS-1 REVIEW QUESTIONS

Objectives. After completing this lesson, you should be able to do the following:

Sample Question Paper

Relational Database Management Systems Mar/Apr I. Section-A: 5 X 4 =20 Marks

Q.1 Short Questions Marks 1. New fields can be added to the created table by using command. a) ALTER b) SELECT c) CREATE. D. UPDATE.

NURSING_STAFF NNbr NName Grade


INTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION. Subject- Informatics Practices

IBM DB2 9 Family Fundamentals. Download Full Version :

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

Solved MCQ on fundamental of DBMS. Set-1

Databases - 3. Null, Cartesian Product and Join. Null Null is a value that we use when. Something will never have a value

King Fahd University of Petroleum and Minerals

Introduction to Database Systems. The Relational Data Model

INTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION

Introduction to Database Systems. The Relational Data Model. Werner Nutt

The Seven Case Tables

Chapter 6: RELATIONAL DATA MODEL AND RELATIONAL ALGEBRA

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

The Relational Model

ECE 650 Systems Programming & Engineering. Spring 2018

King Fahd University of Petroleum and Minerals

IBM A Assessment: DB2 9 Fundamentals-Assessment. Download Full Version :

Programming the Database

PES Institute of Technology Bangalore South Campus (1 K.M before Electronic City,Bangalore ) Department of MCA. Solution Set - Test-II

CS275 Intro to Databases

Downloaded from

Database Foundations. 6-3 Data Definition Language (DDL) Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Database Design. 1-3 History of the Database. Copyright 2015, Oracle and/or its affiliates. All rights reserved.

CS425 Fall 2016 Boris Glavic Chapter 2: Intro to Relational Model

2011 DATABASE MANAGEMENT SYSTEM

Mahathma Gandhi University

Databases - 3. Null, Cartesian Product and Join. Null Null is a value that we use when. Something will never have a value

In mathematical terms, the relation itself can be expressed simply in terms of the attributes it contains:

Chapter 4. Basic SQL. SQL Data Definition and Data Types. Basic SQL. SQL language SQL. Terminology: CREATE statement

1Z0-007 ineroduction to oracle9l:sql

Active Databases Part 1: Introduction CS561

COSC344 Database Theory and Applications. σ a= c (P) Lecture 3 The Relational Data. Model. π A, COSC344 Lecture 3 1

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

Relational Data Model. Christopher Simpkins

Objectives. After completing this lesson, you should be able to do the following:

Chapter 1: Introduction

Definitions. Database Architecture. References Fundamentals of Database Systems, Elmasri/Navathe, Chapter 2. HNC Computing - Databases

Relational Model History. COSC 304 Introduction to Database Systems. Relational Model and Algebra. Relational Model Definitions.

The Relational Model

ER Model. Objectives (2/2) Electricite Du Laos (EDL) Dr. Kanda Runapongsa Saikaew, Computer Engineering, KKU 1

Introduction to Relational Databases. Introduction to Relational Databases cont: Introduction to Relational Databases cont: Relational Data structure

Basant Group of Institution

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

2.2.2.Relational Database concept

Fundamentals of Database Systems

RELATIONAL DATA MODEL

Come And Join us At Worlds Top Study Site

5 Integrity Constraints and Triggers

Relational Model Introduction

Transcription:

1 King Fahd University of Petroleum and Minerals Information and Computer Science Department ICS 334: Database Systems Semester 041 Major Exam 1 18% ID: Name: Section: Grades Section Max Scored A 5 B 25 C 10 D 10 E 20 F 30 TOTAL 100

Section A True False Questions [5 marks - 1 mark per question] 2 Circle the correct answer. 1. A foreign key must always refer to a unique key. a. TRUE b. FASLE 2. If a Primary key consists of more than one attribute, one of its component attributes can be null a. TRUE b. FASLE 3. A relation can have duplicate rows. a. TRUE b. FALSE 4. SQL can result in duplicate rows. a. TRUE b. FALSE 5. In an SQL SELECT statement, we can have HAVING clause even with out GROUP BY clause. a. TRUE b. FALSE

Section B - Multiple Choice Questions each] 3 [25 marks 2.5 marks In the following multiple choice questions, more than one choice may be correct. Circle all correct answers. 1. Which of the following is a result of a DML statement a. Changing the number of tuples in a relation b. Retrieving tuples from a relation c. Creating a new relation d. Changing the domain of an attribute e. Changing the value of an attribute 2. Which of the following is/are TRUE about foreign keys a. A foreign key is always a primary key in the owner relation. b. A foreign key can be null c. A foreign key must be unique and not necessarily a primary key in the owner relation. d. A foreign key must be part of the primary key e. A foreign key must be unique 3. Which of the following does NOT change a database state a. Changing the degree of a relation b. Changing the cardinality of a relation c. Adding a constraint d. Creating a new table e. Retrieving records from a database 4. Which of the following is/are TRUE a. Each value in a tuple is atomic b. Each tuple has distinct values. c. Order of tuples in a relation has no significance. d. Each relation must have an alternate key e. None of the above 5. Which of the following is TRUE about superkeys a. If you reduce the number of attributes in a superkey it will still be a super key. b. If you increase the number of attributes in a superkey it will still be a superkey. c. A superkey will always identify one tuple in a relation d. If you increase the number of attributes in a candidate key it will no longer be a candidate key but it will still be a superkey. e. Some candidate keys are not superkeys

4 6. Which of the following statements is/are TRUE a. Logical data independence is the capacity to change the internal schema without having to change the conceptual schema. b. Physical data independence is the capacity to change the internal schema without having to change the conceptual schema. c. Logical data independence is the capacity to change the conceptual schema without having to change the external schema or application programs d. Physical data independence is the capacity to change the conceptual schema without having to change the external schema or application programs e. Physical and logical data independence is not a characteristic of file-based data management approach. 7. Which of the following statements does NOT change a database schema a. Changing the degree of a relation b. Changing the cardinality of a relation c. Adding a constraint d. Changing the domain of an attribute e. Changing a value of an attribute 8. Which of the following is NOT a result of a DDL statement a. Reducing the number of tuples in a relation b. Changing the domain of an attribute c. Changing the value of an attribute d. Dropping or creating a table e. Adding a constraint\ 9. Which of the following is a component of a DBMS a. Data Manager b. Disk Manager c. Run-time database processor d. Query compiler e. Process manager 10. Which of the following statements is TRUE a. It is impossible to have a foreign key in a database if there is only one table in the database. b. A table may or may not have a primary key. c. Some alternate keys are not really superkey d. The UNION ALL operation may result in duplicate rows. e. In a SELECT statement the GROUP BY clause is done before the WHERE clause.

Section C Answer all the following questions 5 1. Use the following two tables to answer the next question. LECTURER LID Fname Lname Age 111 Amin Al-Hashem 22 222 Ali Al-Eid 33 333 Sadiq Al-Marhoon 44 444 Hani Al-Tawfiq 55 SUBJECT CODE Name LID ICS101 Fortran 333 ICS102 Java 222 ICS202 Data structures 111 ICS334 Databases 222 ICS431 Operating Systems 333 Business Rule: The age of a lecturer must be between 18 and 65. Match each DML statement in table B with all the integrity constraints it violates from table A. Write your answers in the second column of B. [10 points] A Label Integrity Constraint 1 Entity 2 Domain 3 Key 4 Referential 5 No integrity Violation B DML Statements INSERT(111, Hussain, Al-Olaiyan, 28) INTO LECTURER UPDATE LECTURER SET LID=555 WHERE LID=333 UPDATE SUBJECT SET LID = 444 WHERE LID = 222 DELETE FROM LECTURER WHERE LID=222 INSERT(777, Ali, Al-Duwais, 66) INTO LECTURER Violated Constraint Label

Section D Answer the following question. 6 1. What is the use of a foreign key constraint? [3 points] 2. Explain the self describing characteristics of a DBMS. [4 points] 3. One of the DBMS advantages is flexibility. What does it mean? [3 points]

Section E Consider the following relational schema 7 Department (Deptno, DName, Loc) Student (StuID, FirstName, LastName, Address, City, CourseID) Course (CourseID, Name, Deptno) Teach (CourseID, FacID) Faculty (FacID, FirstName, LastName, RoomNo, TelNo, Deptno) Assume attributes with the same name are related. Give relational Algebraic expression to answer the following queries: [20 Points, 4 points each] 1. List of faculty names, department names and location having location New Campus. 2. List of student name, address, city and course name having department number is 321. 3. List of course id (use rename as Course Code), course name, faculty name and department name with department number 318. 4. Get the list of faculty names that are teaching courses. 5. Get the names of all lecturers (or faculty members) who teach student 895241.

8 Section F Write down SQL statements of the following queries (Use appendix s sample tables to evaluate this question) 1. List of employee s name, hiredate, salary and department name with no commission. [3 points] 2. List of employees (employee number,salary, hiredate) with job titles Clerk, Salesman and Manager. [3 points] 3. List of employee s name and job title with name contains letters ar. [4 points] 4. List of job titles that are assigned to more than one employee other than job title Clerk. [4 points]

9 5. List of employees with salary equals to maximum salary of employee (s). [4 points] 6. Create table for the following structure Doctor (EmpID, FirstName, MiddleName, LastName, Address, City, TelNos) Where EMPID is a primary key and LastName must not be null. [4 points] 7. Add a column called Salary to the Doctor table that you created in question 6. [4 points] 8. List of employees who have same job title and same manager (supervisor) as employee number 7369. [4 points]

DEPTNO is a PK in DEPT and EMPNO is a PK in EMP, whereas DEPTNO is a FK in EMP table APPENDIX: 10 SQL> select * from dept; DEPTNO DNAME LOC ---------- -------------- ------------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON SQL> select * from emp; EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ---------- ---------- --------- ---------- ----------- ---------- ---------- ---------- 7369 SMITH CLERK 7902 17-DEC-1980 800 20 7499 ALLEN SALESMAN 7698 20-FEB-1981 1600 300 30 7521 WARD SALESMAN 7698 22-FEB-1981 1250 500 30 7566 JONES MANAGER 7839 02-APR-1981 2975 20 7654 MARTIN SALESMAN 7698 28-SEP-1981 1250 1400 30 7698 BLAKE MANAGER 7839 01-MAY-1981 2850 30 7782 CLARK MANAGER 7839 09-JUN-1981 2450 10 7788 SCOTT ANALYST 7566 19-APR-1987 3000 20 7839 KING PRESIDENT 17-NOV-1981 5000 10 7844 TURNER SALESMAN 7698 08-SEP-1981 1500 0 30 7876 ADAMS CLERK 7788 23-MAY-1987 1100 20 7900 JAMES CLERK 7698 03-DEC-1981 950 30 7902 FORD ANALYST 7566 03-DEC-1981 3000 20 7934 MILLER CLERK 7902 23-JAN-1982 1300 10 7935 EJAZ ANALYST 7782 12000 500 16 rows selected.