0% found this document useful (0 votes)
17 views

DBMS assignment_02

The document is a tutorial for SQL, detailing the creation of four tables related to employees, jobs, and plans, along with specific SQL queries to retrieve and update data. It includes instructions for creating two additional tables for students and courses, emphasizing the importance of primary and foreign keys. The submission deadline for the tutorial is set for July 29, 2020.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

DBMS assignment_02

The document is a tutorial for SQL, detailing the creation of four tables related to employees, jobs, and plans, along with specific SQL queries to retrieve and update data. It includes instructions for creating two additional tables for students and courses, emphasizing the importance of primary and foreign keys. The submission deadline for the tutorial is set for July 29, 2020.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Tutorial No-02-SQL

Year II Semester I (FC-21324)


Date:- 2020.07.08

1)

EMP JOB
EMP_CODE EMP_LNAME JOB_CODE
JOB_CODE JOB_DESCRIPTION
14 Nimal 2
15 Sadun 1 1 Clerical
16 Ajith 1 2 Technical
17 Kamal 3
3 Managerial
20 Gayan 2

PLANS EMP_PLAN
PLAN_CODE PLAN_DESCRIPTION EMP_CODE PLAN_CODE
1 Term life 15 2
2 Stock purchase 14 3
Long-term 16 1
3
disability 17 1
4 Dental 17 3
17 4
20 3

I. Create the above four tables using SQL statements and insert the given (20 Marks)
values to the tables. Identify the suitable domains for each attribute.
(Important:-Consider about the correct primary keys and foreign keys).

II. Write SQL statements for the following questions.


(05Marks)
a) All information of the employees whose emp_code is less than 17.
b) Names of employees whose emp_lname contains letter ‘y’ anywhere
in the name. (05Marks)

c) The minimum emp_code and give the column name as min_emp. (05Marks)

d) Emp_lname and job_description of all the employees whose


jobe_code is equal to 1 and emp_lname is ‘Sadun’. (10Marks)
e) Emp_lname and plan_code of all the employees whose job code is (10Marks)
equal to 2.
f) Update the ‘Stock purchase to ‘Stock’ in plans table. (15Marks)

2)
3)
Create the following two tables using SQL statements. Use the suitable (30 Marks)
Domains for each attribute. (Important:-Consider about the
correct primary keys and foreign keys.)

Student (stid, sname, address, courseid, age)

Course (CNo, cname, building, studentid)

Submit on or before 29.07.2020

You might also like