You are on page 1of 17

PRACTICAL-FILE

For Central Board of Secondary


Education ( ):2021-2022

SUBMITTED BY: SUBMITTED TO:


Shaurya Aggarwal Mr.Bhupinder Singh
XII-A (I.P Teacher)
This is to certify that SHAURYA AGGARWAL of class
XII-A of Delhi Public School, Saharanpur has completed
his project work under my supervision. He has taken
proper care & shown utmost sincerity in completion of
this project. I certify that this project work is upto my
expectation & as per the guidelines issued by CBSE,
New Delhi.

Signature: Signature:
Mr.………………… Mrs…………………
…………………….. …………………….
(Subject teacher) (Principal)
Delhi Public School Delhi Public School
Saharanpur. Saharanpur.
MySQL PROGRAMS:
Q1.
ANSWER:
Q2.

Write commands of SQL for (i) to (iv) .


(i) To display names and drink codes of those drinks that have more than 120
calories
(ii) To display drink codes, names and calories of all drinks, in descending order of
calories
(iii) To display names and price of drinks that have price in the range 12 to 18 (both
12 and 18 included).
(iv) Increase the price of all drinks in the given table by 10% .

ANSWER:
(i)
(ii)

(iii)

(iv)

----------x---------------x--------------x-------------x--------------x-------------x-------
Q3.

ANSWER:
(i)

(ii)

(iii)

(iv)

(v)
Q4.

ANSWER:
(a)

(b)

(c)

(d)

(e)
Q5.

ANSWER:
(a) (b)

(c)
Q6.

(i)Write a query to display sum, average, highest and lowest salary of


employees.

(ii)Write a query to display sum, average, highest and lowest salary of


employees grouped by department number.

(iii)Write a query to display sum, average, highest and lowest salary of


employees grouped by department number and sub grouped by job.

(iv) Which SQL aggregate function is used to count all records of a
table?
→ COUNT(*)
(v)Write a query to display number of employees with same job.

(vi)Write a query to display difference of highest and lowest salary of


each department having maximum salary >4000.

---------x-------------x-------------x------------x--------------x--------------x----------
Q7. In a database Company, there are two tables given below:

Table: SALES Table:LOCATION

Write SQL queries for following:


(i)To display SalesmanID, names of salesmen, LocationID, with
corresponding Location names.

(ii)To display names of salesmen,sales and name of corresponding


Location names who have ahieved sales more than 1300000.

(iii)To display names of those salesmen who have ‘singh’ in their names.

(iv)Identify Primary key in table SALES. Give reason for your choice.
→ Primary key: SALESMANID, because it unniquely identifies all ROWS in
the table and does not contain empty/zero or null values.

(v)Write SQL command to change LocationID to 104 of Salesman with


ID as S3 in table ‘SALES’.

---------X----------------X-----------------------X-------------------X------------------X-------
:

1. Hardware Configuration:
Processor: i5-3210M
CPU @ 2.50GHz
RAM : 4.00GB
System type : 32-bit
Computer name- lenovo PC
Windows edition: Windows 7 Ultimate
2. Software: MySQL
OS: Windows
3. Reference book: Informatics Practices by
Sumita arora.

You might also like