Honey Choudhary Mysql CH 14

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

Q:-7 Write SQL queries for (A) to (D) based on the tables

PASSENGER AND FLIGHT given below:

Table: PASSENGER

Table: FLIGHT1
(A)Write a query to change the fare to 6000 of the flight
whose FNO is F104.

(B)Write a query to display the total number of MALE


and FEMALE PASSENGER.
(C)Write a query to delete the records of flights which
end at Mumbai.
Q:-8Given the following tables for a database LIBRARY:

Table: BOOKS

Table: ISSUED1
(A)To show Book_Name,Author_Name and Price of
BOOKS of First Publ. Publishers.

(B)To list the names from BOOKS of text page.


(C)To display the names and price from books in
ascending order of their price.

(D)To increase the price of all books of EPB Publishers by


50.
(E) To insert a new row in the table Issued having the
following data: “F0003”, 1.

(F)SELECT COUNT (*) FROM Books;


Q:-9Consider the following DEPT and WORKER tables.
Write SQL queries for (a) to (d) find output for SQL.

Table: DEPT1

Table: WORKER
(A)To display WNO, Name, Gender from the table
WORKER in descending order of WNO.

(B)To display the Names of all the FEMALE workers from


the table WORKER.
(C)To display the WNO and Name of those workers from
the table WORKER who are born between ‘1997-01-01’
and ‘1991-12-01’.

(D)To count and Display MALE workers who have joined


after‘1986-01-01’.
(E)SELECT COUNT (*), DECODE FROM WORKER GROUP
BY DECODE HAVING COUNT (*)>1;

(F)SELECT DISTINCT DEPARTMENT FROM DEPT1;


(G)SELECT NAME, DEPARTMENT, CITY FROM WORKER W,
DEPT1 D WHERE W.DCODE = D.DCODE AND WNO<1003;

(H)SELECT MAX (DOJ), MIN (DOB) FROM WORKER;


Q:-10Following questions are based on these tables:

Table: BOOKS_INFORMATION

Table: SALES
Table: EXAM_RESULTS

(A)SELECT AVG (EXAM_SCORE) FROM EXAM_RESULTS;


(B)SELECT EXAM_ID,COUNT(DISTINCT STU_ID)FROM
EXAM_RESULTS GROUP BY EXAM_ID;

(C)SELECT *FROM EXAM_RESULTS WHERE LNAMELIKE’L


%’;
(D)SELECT MAX (EXAM_SCORE) FROM EXAM_RESULTS
GROUP BY EXAM_ID HAVING EXAM_ID=1;
Q:-11Given the following table:

Table: CLUB

(A)SELECT COUNT (DISTINCT SPORTS) FROM Club;


(B)SELECT MIN (Age) FROM CLUB WHERE Sex=’F’;

(C)SELECT AVG (Pay) FROM CLUB WHERE


SPORTS=’KARATE’;
Q:-12In a Database, there are two tables given below:

Table: EMPLOYEE

Table: JOB
(A)To display employee ids, names of employees, job ids
with corresponding job titles.

(B)To display the names of employees, sales and


corresponding job titles who have achieved sales more
than 1300000.
(C)To display names and corresponding job titles of those
employees who have ‘SINGH’ (anywhere) in their names.

(D)Write SQL command to change the JOBID to 104 of


the EMPLOYEE with ID as E4 in the table ‘EMPLOYEE’.
Q:-13Consider the following tables Employee 1 and
Salary. Write a SQL commands for the statements (A) to
(D) and give output for SQL queries (E) to (G).

Table: Employee 1

Table: Salary
(A)To display the frequency of employees department
wise.

(B)To list the names of those employees only whose


names start with ‘H’.
(C)To add a new column in the Salary table. The column
name is Total_ Sal.

(D)To store the corresponding values in the Total_ Sal


column.
(E)Select max (Basic) from Salary where Bonus>40;

(F)Select count (*) from Employee1 group by Sec;


(G)Select Distinct Dep id from Employee 1;
Q:-14With reference to following relations Personal and
Jobs answer the questions that follow:

Table: Personal

Table: Jobs
(A)Show No, Name and Salary of those who have Sports
as Hobby.

(B)Show Name of the eldest Employee.


(C)Show No of Employee Area Wise.

(D)Show No, Name, Hobby and Salary in descending


order of Salary.
(E)Show the hobbies of those whose Name Pronounces
as ‘Abhay’.

(F)Show the Appointment date and Native place of those


whose names start with ’A’ or ends with‘d’.
(G)Show the Hobby of which there are 2 or more
Employees.

(H)Add a new tuple in the table Personal essentially with


Hobby as Music.
(I)Insert a new column email in the Jobs Tables.

(J)Write the output of:

(1)Select Distinct Hobby from Personal;


(2)Select Avg (Salary) from Personal, Jobs where
Personal. No=Jobs. No and Area in (‘Agra ’,’Delhi’);

(3)Select count (Distinct Native place) from Personal;


(K)Remove the table Personal.
Q:-15With reference to the table below, answer the
questions that follow:

Table: Employees1

Table: EmpSalary
(A)To show the First name, Last name, Address and City
of all Employees 1 living in Paris.

(B)To display the content of Employees 1 table in


descending order of First name.
(C)To display the First name, Last name and Total Salary
of all Managers from the table Employees 1 and Emp
Salary, where Total Salary is calculated as Salary+
Benefits.

(D)To display the maximum Salary among managers and


clerks from the table Emp Salary.

(E)Give the output of following SQL commands:


(1)Select count (distinct designation) from Emp Salary;

(2)Select Designation, Sum (Salary) from Emp Salary


group by Designation having count (*)>2;
(3)Select sum (Benefits) from Emp Salary where
Designation=’Clerk’;
Q:-16Consider the following MOVIES table and write the
SQL queries based on it.

Table: MOVIES

(A)Display all the information from the MOVIES table.


(B)List business done by Movies showing only Movie Id,
Movie Name and Total_ Earning. Total_ Earning to be
calculated as the sum of Product Cost and Business Cost.

(C)Find the Net Profit of each Movie showing its Id, Name
and Net Profit. Net profit is to be calculated as difference
between Business Cost and Product Cost.
(D)List Movie Id, Movie Name and Cost of all Movies with
Product Cost grater than 10,000 and less than 1,00,000 .

(E)List details of all Movies which fall in the category of


Comedy or Action.
Q:-17Write a SQL commands for the following on the
basis of given table MOV:

Table: MOV

(A)Display a list of all movies with Price over 20 and


sorted by Price.
(B)Display all the Movies sorted by QTY in descending
order.

(C)Display the report listing a movie number, current


value and replacement value for each Movie in the above
table. Calculate the replacement value for all Movies as:
QTY*Price*1.15.
Q:-18Write SQL commands for the following on the basis
of given table Teacher:

Table: Teacher

(A)To show all information about the teacher of History


Department.
(B)To list names of all teachers with their Date of joining
in ascending order.
Q:-19Consider the following table VACCINATION_ DATA.
Give the output of following SQL statement.

Table: VACCINATION_ DATA

(A)SELECT Name, Age FROM VACCINATION_ DATA


WHERE Dose2 IS NOT NULL AND Age>40;
(B)SELECT DISTINCT City FROM VACCINATION_DATA;

(C)SELECT MAX (Dose1), MIN (Dose2) FROM


VACCINATION_DATA;
Q:-20Consider the following table EMPLOYEE and write
the SQL queries based on it.

Table: EMPLOYEE
(A)Display Emp no and E Name of all employees from
table EMPLOYEE.

(B)Display E Name, Salary and Salary+ Comm from table


EMPLOYEE.
(C)Select all Department numbers in table EMPLOYEE.

(D)Write a query to display Employee Name, Salary and


Department Number who are not getting commission
from table EMPLOYEE.
(E)Write a query to display Employee Number, Name,
Salary and Salary*12 as Annual Salary whose commission
is not NULL from the table EMPLOYEE.

(F)List all unique Departments numbers in the table


EMPLOYEE.
(G)List details of all Clerk.

(H)List the details of all those Employees whose Annual


Salary is between 25000-40000.
(I)How many Job types are offered to employees .

(J)List the details of Employees who earn more


Commission than their Salary.
Q:-3Write a SQL commands for the following on the basis
of the given table CLUBS.

Table: CLUBS

(A)To show all information about the swimming coaches


in the Club.
(B)To list names of all coaches with their age in
descending order.

(C)To display a report, showing Coach Name, Pay, Age


and Bonus (15%of Pay) for all the coaches.
Q:-6Given the following table:

Table: STUDENT

(A)SELECT MIN (Avg Mark) FROM STUDENT WHERE Avg


Mark<75;
(B)SELECT SUM (Stipend) FROM STUDENTS WHERE
Grade=’B’;

(C)SELECT AVG (Stipend) FROM STUDENT WHERE


CLASS=’12A’;
Q:-5Consider the table STUDENT1. Give output of the
following statements.

Table: STUDENT1

(A)SELECT ROUND (Avg Mark) FROM STUDENT1 WHERE


GRADE=’B’;
BETHESDA, CHRISTIAN, ACADEMY
(GOYNA) HAPUR, MODINAGAR ROAD

Year: 2023-24

CLASS: 12 “COMMERCE”
ROLL NO: 8
SUBJECT: COMPUTER SCIENCE
TOPIC: SQL PROGRAMS FILE
SUBMITTED TO: MISS MINI MURLIDHAR
SUBMITTED BY: HONEY CHOUDHARY
Acknowledgement
 I would like to sincerely thank my teacher
MRS.MINI MURLIDHAR for providing all
the necessary resources and facilities in the
school, without those resources this project
would not have been completed.

Also, my parent’s & friend’s support played a


big role for me. I thank them all and wish that
they will keep supporting me like this.

I did this project not only to get marks but also


to improve my technical knowledge. During this
project, I acquired many valuable skills, and I
hope that these will help me in my future career.
CERTIFICATE

THIS IS TO CERTIFY THAT HONEY CHOUDHARY OF


CLASS/SEC 12 “COMMERCE” HAS SUCCESSFULLY
COMPLETED THE PROJECT ENTITLED SQL PROGRAMS
TO MY SATISFACTION AND SUBMITTED THE SAME
DURING THE ACADEMIC YEAR 2023-24. THE PROJECT IS
THE RESULT OF HIS/HER EFFORTS & ENDEAVORS.

DATE: …………
MS. MINI MURLIDHAR
TEACHERS SIGNATURE: ……………………..
TABLE OF CONTENTS

S.No. Topic T.Sign


S.No. Topic T.Sign

You might also like