0% found this document useful (0 votes)
3 views6 pages

SQL Practicals Complete File

This document is a practical file for Computer Science submitted by Nancy from Class XII-D for the academic session 2023-2024. It includes SQL queries for various tables such as Movie, Patient, Team, and Stock, demonstrating the application of SQL commands. The document also contains acknowledgments and a certificate of completion.

Uploaded by

bbruh7320
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)
3 views6 pages

SQL Practicals Complete File

This document is a practical file for Computer Science submitted by Nancy from Class XII-D for the academic session 2023-2024. It includes SQL queries for various tables such as Movie, Patient, Team, and Stock, demonstrating the application of SQL commands. The document also contains acknowledgments and a certificate of completion.

Uploaded by

bbruh7320
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

Computer Science

MY SQL File

Submitted By:
Name: Nancy
Class: XII-D
Roll No: 11

Submitted To:
Teacher's Name: [Link]

Session: 2024–2025
Acknowledgement
I would like to express my sincere gratitude to my
Computer Science teacher for their invaluable
guidance and constant support throughout the
preparation of this practical file. Their
encouragement has motivated me to work with
dedication and sincerity.
I would also like to thank my school for providing
me with the facilities and resources required to
complete this project.
Lastly, I am grateful to my parents and friends for
their encouragement.
Certificate
This is to certify that NANCY of Class XII-D
has successfully completed the Computer
Science Practical File for the academic session
2023–2024. The practical file is in accordance
with the CBSE curriculum.
Date: _____________

Signature of Teacher: ___________________________

Signature of Principal:
___________________________
SQL Practical File

*Movie Table Queries


Movie_ID MovieName Type ReleaseDate ProductionCost BusinessCost

M001 Dahek Action 2022-01-26 1245000 1300000

M002 Attack Action 2022-01-28 1120000 1250000

M003 Looop Thriller 2022-02-01 250000 300000


Lapeta

M004 Badhai Do Drama 2022-02-04 720000 68000

M005 Shabaash Biography 2022-02-04 1000000 800000


Mithu

M006 Gehraiyaan Romance 2022-02-11 150000 120000

Queries:

SELECT * FROM Movie;

SELECT DISTINCT Type FROM Movie;

SELECT Movie_ID, MovieName, ProductionCost+BusinessCost AS


Total_Earning FROM Movie;

SELECT Movie_ID, MovieName, ProductionCost FROM Movie WHERE


ProductionCost>150000 AND ProductionCost<1000000;

SELECT MovieName FROM Movie WHERE Type='Action' OR Type='Romance';

SELECT MovieName FROM Movie WHERE MONTH(ReleaseDate)=2;

Patient Table Queries


Queries:

SELECT SUM(Charges) FROM Patient WHERE DateOfAdm LIKE '%-11-%';

SELECT PName, MAX(Age) FROM Patient;

SELECT COUNT(DISTINCT Department) FROM Patient;

SELECT AVG(Charges) FROM Patient;


Q20. Sports Database
Table: TEAM

TeamID TeamName

1 Tehlka

2 Toofan

3 Aandhi

4 Shailab

Queries:

CREATE DATABASE Sports;

CREATE TABLE Team (TeamID INT PRIMARY KEY, TeamName VARCHAR(10));

DESC Team;

INSERT INTO Team VALUES


(1,'Tehlka'),(2,'Toofan'),(3,'Aandhi'),(4,'Shailab');

SELECT * FROM Team;

CREATE TABLE Match_Details (MatchID VARCHAR(2) PRIMARY KEY, MatchDate


DATE, FirstTeamID INT REFERENCES Team(TeamID), SecondTeamID INT
REFERENCES Team(TeamID), FirstTeamScore INT, SecondTeamScore INT);

Match Details Queries


Queries:

SELECT [Link], [Link], [Link], [Link] FROM


Match_Details m, Team t WHERE [Link]=[Link] AND
[Link]>70;

SELECT MatchID, TeamName, SecondTeamScore FROM Match_Details, Team


WHERE Match_Details.SecondTeamScore BETWEEN 100 AND 160;

SELECT MatchID, TeamName, MatchDate FROM Match_Details, Team WHERE


Match_Details.FirstTeamID=[Link];

SELECT DISTINCT(TeamName) FROM Match_Details, Team WHERE


Match_Details.FirstTeamID=[Link];
SELECT MatchID, MatchDate FROM Match_Details, Team WHERE
Match_Details.FirstTeamID=[Link] AND TeamName IN
('Aandhi','Shailab');

Stock Table Queries


ItemNo Item DCode Qty UnitPrice

S005 Ballpen 102 100 10

S003 Gel Pen 101 150 15

S002 Pencil 102 125 5

S006 Eraser 101 200 3

S001 Sharpner 103 210 5

S004 Compass 102 60 35

S009 A4 Papers 102 160 5

Queries:

SELECT * FROM Stock ORDER BY StockDate;

SELECT DCode, MAX(UnitPrice) FROM Stock GROUP BY DCode;

SELECT * FROM Stock ORDER BY Item DESC;

SELECT DCode, AVG(UnitPrice) FROM Stock GROUP BY DCode HAVING


AVG(UnitPrice)>5;

SELECT DCode, SUM(Qty) FROM Stock GROUP BY DCode;

You might also like