Unit 1 DBMS

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

19UCSPC301- DATABASE MANAGEMENT SYSTEMS

UNIT 1, 2 - ASSIGNMENT
Batch 1 : 1,4,5 (Roll num 1,9,10,14,6)
Batch 2: 2, 7 ,8 (Roll num 2,4,8,7,13)
Batch 3: 3, 9 ,6 (Roll num 3,5,11,12)

1. Create Tables as follows by choosing appropriate data type and set the necessary primary
and foreign key constraints: Product (Prodid, Prodesc, Price, Stock) Purchase (Purid,
Proid, qty), Add a column customer name in Purchase table.

2. Consider the following relation


Jedi-Teams (master, apprentice)
Jedi(name, side, home-planet)
Government(leader planet, postition)
Inhabitants(specie, planet)
Given a query to find all planetary leaders who are apprentices and use the dark side of the
force and give the query in relational algebra expression.

3. Consider there are certain strings available in a database. Mention the


command used to fetch first 5 characters of the string?

4. Write a SQL query to fetch employee names having salary greater than or equal
to 5000 and less than or equal 10000.

5. Examine the structure of the EMPLOYEES table. You issue the following
command:
INSERT INTO EMPLOYEES (employee_id , first_name , job_id) VALUES
(5100, 'BRUCE', 'CLERK');
Assuming that there is a duplicate value check constraint on the
EMPLOYEE_ID column, what will be the outcome of the above statement?
How would you approach this problem using multivariate analysis?

6. Write an SQL query to Select all employees from department numbers 7369,
7499 and Display all the details of the records whose employee name starts
with ‘S’.

7. Design an ER diagram for keeping track of the exploits of yourfavourite sports team. You
should store the matches played, the scoresin each match, the players in each match, and
individual playerstatistics for each match. Summary statistics should be modelled as derived
attributes.

8. You need to find the salaries for all the employees who have a higher salary than the Vice
President of a company 'ABC'.What is the query used to obtain the result?
(Consider the table structure as given)
SQL> DESC employees

Name Null? Type

----------------------- -------- ----------------

EMPLOYEE_ID NOT NULL NUMBER(6)

FIRST_NAME NOT NULL VARCHAR2(20)

LAST_NAME NOT NULL VARCHAR2(25)

EMAIL NOT NULL VARCHAR2(25)

PHONE_NUMBER VARCHAR2(20)

HIRE_DATE NOT NULL DATE

JOB_ID NOT NULL VARCHAR2(10)

SALARY NUMBER(8,2)

COMMISSION_PCT NUMBER(2,2)

MANAGER_ID NUMBER(6)

DEPARTMENT_ID NUMBER(4)

9. Construct an ER 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. Each
insurance policy covers one or more cars, and has one or more premium payments associated
with it. Each payment is for a particular period of time, and has an associated due date, and
the date when the payment was received.

You might also like