challenging questions for toppers

4
UNIT – I 1. ) Construct an E-R diagram for a car-insurance company whose customers own one or more cars each. Each car has associated with it zero to any number of recorded accidents. State any assumptions you make 2.Construct an ER diagram for an employee payroll system. 3.Construct an ER-diagram for hospital with a set of patients and a set of medical doctors. Associate with each patient a log of the various test and examinations conducted. 4.Develop an entity relationship model for a library management system. Clearly state the problem definition, description, business rules and any assumption you make. 5. (ii) A university registrar’s office maintains data about the following entities : (1) Courses, including number, title, credits, syllabus , and prerequisites; (2) Course offerings , including course number, year, semester , section number, instructor, timings, and classroom; (3) Students, including student-id, name, and program; and (4) Instructors, including identification number, name, department, and title. Further, the enrollment of students in courses and grades awarded to students in each course they are enrolled for must be appropriately modeled. Construct an E-R diagram for the registrar’s office. Document all assumptions that you make about the mapping constraints. UNIT II 1. Consider the following six relations for an Order- processing Database Application in a Company CUSTOMER (CUSTNO, CNAME, CITY) ORDER (ORDERNO, ODATE, CUSTNO, ORD_AMT) ORDER_ITEM (ORDERNO, ITEMNO, QTY) ITEM (ITEMNO, ITEM_NAME, UNIT_PRICE) SHIPMENT (ORDERNO, ITEMNO, WAREHOUSENO, SHIP_DATE) WAREHOUSE (WAREHOUSENO, CITY)

Upload: miraclesuresh

Post on 31-Dec-2015

22 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Challenging Questions for Toppers

UNIT – I

1. ) Construct an E-R diagram for a car-insurance company whose customers own one or more cars each. Each car has associated with it zero to any number of recorded accidents. State any assumptions you make

2. Construct an ER diagram for an employee payroll system.

3. Construct an ER-diagram for hospital with a set of patients and a set of medical doctors. Associate with each patient a log of the various test and examinations conducted.

4. Develop an entity relationship model for a library management system. Clearly state the problem definition, description, business rules and any assumption you make.

5. (ii) A university registrar’s office maintains data about the following entities :(1) Courses, including number, title, credits, syllabus, and prerequisites;(2) Course offerings, including course number, year,semester, section number, instructor, timings, and classroom;(3) Students, including student-id, name, and program; and(4) Instructors, including identification number, name,department, and title. Further, the enrollment of students in courses and grades awarded to students in each course they are enrolled for must be appropriately modeled. Construct an E-R diagram for the registrar’s office. Document all assumptions that you make about the mapping constraints. 

UNIT II

1. Consider the following six relations for an Order-processing Database Application in a Company CUSTOMER (CUSTNO, CNAME, CITY)ORDER (ORDERNO, ODATE, CUSTNO, ORD_AMT)ORDER_ITEM (ORDERNO, ITEMNO, QTY)ITEM (ITEMNO, ITEM_NAME, UNIT_PRICE)SHIPMENT (ORDERNO, ITEMNO, WAREHOUSENO,SHIP_DATE)WAREHOUSE (WAREHOUSENO, CITY)Here, ORD_AMT refers to total amount of an order; ODATE is the date the order was placed; SHIP_DATE is the date an order is shipped from the warehouse. Assume that an order can be shipped from several warehouses. Specify the foreign keys forthis schema, stating any assumptions you make

2. Consider the following relational database

Employee(employee- name , street, city)

Page 2: Challenging Questions for Toppers

Works (Employee-name, company- name, salary)

Company (company –name, city)

Manager( employee-name, manager- name)

Give an SQL DDL definition of this database. Identify referential integrity constraints that should hold and then include them in a DDL definition.

3. Consider the following relation

Employee (employee_name, company_name,salary)

Write for the following

(i)find the total salary of each company

(ii)find the employee name who is getting lowest salary

(iii)Find the company name who is getting average lowest salary

(iv)find the employeename whose salary is highest than average salary of TCS.

4. Table Name : Employee

EMPLOYEE_ID FIRST_NAME LAST_NAME SALARY JOINING_DATE DEPARTMENT

1 Jhon Abraham 100000001-JAN-13 12.00.00 AM

Banking

2 Michael Clarke 80000001-JAN-13 12.00.00 AM

Insurance

3 Roy Thomas 70000001-FEB-13 12.00.00 AM

Banking

4 Tom Jose 60000001-FEB-13 12.00.00 AM

Insurance

5 Jerry Pinto 65000001-FEB-13 12.00.00 AM

Insurance

6 Philip Mathew 75000001-JAN-13 12.00.00 AM

Services

7 TestName1 123 65000001-JAN-13 12.00.00 AM

Services

8 TestName2 Lname% 60000001-FEB-13 12.00.00 AM

Insurance

(i)Get unique DEPARTMENT from employee table

(ii)Select TOP 2 salary from employee table

(iii) Select TOP N salary from employee table

(iv) Select 2nd Highest salary from employee table

(v)Select Nth Highest salary from employee table

(vi) Select first 3 characters of FIRST_NAME from EMPLOYEE

Page 3: Challenging Questions for Toppers

UNIT III

1. Consider the universal relation R( A,B,C,D,E,F,G,H,I,J) and the set of FD’s. G=({A,B}?{C}?{B,D}?{E,F} ,{A,D}?{G,H}, {A}?{I}’{H}?{J}) What is the key of R? Decompose R into 2NF, then 3NF relations.

2. consider the following relation

Car-sale(car #, date_sold, salesman#,commission %,discount _amount)

Assume that a car company may sold by multiple salesman and hence (car #, salesman #) is the primay key.

Additional dependencies are

Date _ sold -> discount_amount

And salesman#->commission%

Based on the given primary key is this relation is in 1NF,2NF or 3NF? Why or why not?how would you successfully normalize it completely?

UNIT IV

UNIT V

1. Construct a B+ tree to insert the following key elements (order of the tree is 3) 5, 3, 4, 9, 7, 15, 14, 21, 22, 23.

2. Let relations r1(A,B,C ) and r2(C,D,E) have the propertiesR1 has 20000 tuples, r2 has 45000 tuples ,25 tuples of r1 fit one blockand 30 tuples

of r2 fit one block .Estimate the numbers of transfers and seeks required, using each of the following stratagies: r1∞r2 (join symbol)

(i) Nested loop join(ii) Block nested loop join(iii) Merge join