Database Exit
Database Exit
GENERAL DIRECTIONS:
1. MAKE SURE THAT THE EXAM PAPER CONTAINS 04 PAGES INCLUDING THE
COVER PAGE
2. READ THE INSTRUCTION CAREFULLY FOR ALL PARTS
3. USE ONLY BLUE OR BLACK PANES
2. ________ command makes the updates performed by the transaction permanent in the
database?
A. ROLLBACK C. TRUNCATE
B. COMMIT D. DELETE
3. Which one of the following SQL commands is the same as relational algebra?
SELECT EID, ENAME FROM EMPLOYEE WHERE SkillType=Database”;
A. < EID, ENAME >< SkillType C. < SkillType =”Database”> <
=”Database”> (Employee) EID, ENAME > (Employee)
B. < EID, ENAME > < SkillType D. < EID, ENAME > < SkillType
=”Database”> (Employee) =”Database”> [Employee]
6. The values appearing in given attributes of any tuple in the referencing relation must
likewise occur in specified attributes of at least one tuple in the referenced relation,
according to ______integrity constraint.
A. Referential C. Referencing
B. Primary D. Specific
A. On C. Set
B. Using D. Where
A. Mean(salary) C. Sum(salary)
B. Avg(salary) D. Count(salary)
9. SELECT COUNT (____ ID) FROM teaches
WHERE semester = ’spring’ AND YEAR = 2010;
If we do want to eliminate duplicates, we use the keyword ______in the aggregate
expression.
A. Count C. Primary key
B. Avg D. Distinct
10. Which statement is used to delete all rows in a table without having the action logged?
A. DELETE C. DROP
B. REMOVE D. TRUNCATE
11. How can you change "Thomas" into "Michel" in the "LastName" column in the Users table?
Practical Test
1. Assuming you as a part of design and development of team of an organization, propose E-
R model using E-R diagram for the following data requirements. Also convert and
represent E-R model into tables: Company organized into DEPARTMENT. Each
department has unique name and a particular employee who manages the department. Start
date for the manager is recorded. Department may have several locations. A department
control a number of PROJECT. Projects have a unique name, number and a single location.
Company's EMPLOYEE name, ssno, address, salary, sex and birth date are recorded. An
employee is assigned to one department, but may work for several projects (not necessarily
controlled by her dept). Number of hours/week an employee works on each project is
recorded. Employee's DEPENDENT are tracked for health insurance purposes (dependent
name, birthdate, relationship to employee). Based on the above scenario Assess the
business requirement of the prescriptions and perform the following task by using answer
sheet
1.1. Identify the database Entities of the organization
1.3. Draw entity relationship (ER) diagram for the identified entities with type of Attributes
2. Based the following ER-diagram Write your answer on the paper
Perform all the questions using transact SQL (SQL queries of DDL and DML) for the following
Er-diagram. Put all your answers on the answer sheet after running them on SQL server
2. Create all the tables with their primary key, proper data types, and their relationships
3. Fill five records on each table. For all tables the primary key is given. You can use
appropriate name and values for the remaining fields. Primary key for the relations is given
as follows. Each relation has five records
a. The primary key for bars is (from bar101, bar102 – bar105)
b. The primary key for BEERS is (Meta, Harer, Bedelie, Amber, Habesha)
c. The primary key for DRINKERS is (from Drink301, drink302 – drink305) at least
two should be females
4. Write the following select queries
a. Name of female drinkers and their favorite beers
b. Unit Profit of each beer that each bar sold
c. Total profit of all beers sold