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

DBT Question Paper

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

DBT Question Paper

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

PG-DAC (Sept 2021 Batch)

Date : 4/12/2021
Time : 1:30 PM to 3:30 PM

Instructions : This exam consists of 3 sections. All questions are


compulsory.

Section 1 :
Connect to MySQL database with your respective username and password.

1. Create table DEPT with the following structure: (3 Marks)


DEPTNO int
DNAME varchar(15)
LOC varchar(10)

Insert the following rows into the DEPT table:-


10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON

2. Create table EMP with the following structure: (3 Marks)


EMPNO int
ENAME varchar(10)
JOB varchar(9)
HIREDATE date
SAL float
COMM float
DEPTNO int

Insert the following rows into the EMP table:

7839 KING MANAGER 1991-11-17 5000 NULL 10


7698 BLAKE CLERK 1981-05-01 2850 NULL 30
7782 CLARK MANAGER 1981-06-09 2450 NULL 10
7566 JONES CLERK 1981-04-02 2975 NULL 20
7654 MARTIN SALESMAN 1981-09-28 1250 1400 30
7499 ALLEN SALESMAN 1981-02-20 1600 300 30

Section 2: ( 12 X 2 = 24 marks)

Write SELECT statements to achieve the following

1. Find the names of all employees hired in the month of February (of
any year).

2. Find the names of all employees whose name ends with the letter
‘M’.

3. Display the ENAME and JOB for all employees who belong to the
same DEPTNO as employee ‘KING’.

4. Display the HRA for each employee given that HRA is 20% of
SAL.

5. Display the JOB column with duplicate values suppressed.

6. Display the Enames and the corresponding Dnames.

7. Display the employees in descending order of DEPTNO.

8. Find the names of all employees who do not receive any


commission.

9. Display the employee name and employee number of the


employees with the headings as NUMBER and NAME.
10.Find the name of the employee who is receiving the maximum
salary.
11.Display the sum of SAL for all the employees belonging to
DEPTNO 10.

12.Display the rows where JOB column ends with the letter ‘T’.

Section 3: (2 X 5 marks)

1.Write a stored procedure to convert a temperature in Fahrenheit (F) to its


equivalent in Celsius (C). The required formula is:- C= (F-32)*5/9 Insert the
temperature in Centigrade into TEMPP table. Calling program for the stored
procedure need not be written.

2. Write a stored function by the name of Num_cube. The stored function


should return the cube of a number ‘N’. The number ‘N’ should be passed to the
stored function as a parameter. Calling program for the stored function need not
be written.

You might also like