IP Fair Rec
IP Fair Rec
teacher
1 Queries Set 1 (Database Fetching records) 30.09.2021
2 Queries Set 2 (Based on Functions) 1.10.2021
3 Queries Set 3 (Based on Functions) 5.10.2021
4 Queries set 4 (DDL Commands) 11.01.2022
5 Queries Set 5 (Group by , Order By) 12.01.2022
Sno:1 Date:
Aim: Consider the following MOVIE table and write the SQL queries based on it.
Source Code:
a)select * from movie;
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
e) select moviename from movie where type ='action' or type='romance';
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
f) select moviename from movie where month(releasedate)=2;
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
Sno:2 Date:
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
b) select round(563.854741,-2);
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
c)select mid("Computer",4,3);
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
Source Code:
a)select right("Media",3);
b)select concat(moviename,concat(' - ',type)) from movie;
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
c)select left(productioncost,4) from movie;
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
d)select right(businesscost,4) from movie;
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
e)select weekday(releasedate) from movie;
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
f)select dayname(releasedate) from movie;
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
Sno: 4 Date:
Aim: Suppose your school management has decided to conduct cricket matches between students of Class XI
and Class XII. Students of each class are asked to join any one of the four teams – Team Titan, Team
Rockers, Team Magnet and Team Hurricane. During summer vacations, various matches will be
conducted between these teams. Help your sports teacher to do the following:
a) Create a database “Sports”.
b) Create a table “TEAM” with following considerations:
i. It should have a column TeamID for storing an integer value between 1 to 9, which refers to unique
identification of a team.
ii. Each TeamID should have its associated name (TeamName), which should be a string of length not less
than 10 characters.
iii. Using table level constraint, make TeamID as the primary key.
c) Show the structure of the table TEAM using a SQL statement.
d) Show the contents of the table TEAM using a DML statement
Source Code:
a) create database sports;
b) create table team -> (teamid int(1), -> teamname varchar(10), primary key(teamid));
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
c) desc team;
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
d) select * from team;
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
Sno:5 Date:
Source Code:
a) select * from stock order by stockdate;
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen