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

IP Fair Rec

The document contains details of 5 queries sets practiced on different dates regarding fetching records from databases, functions, DDL commands, and group by and order by clauses. Each query set contains multiple queries with the aim, source code, and output to be written in a table on the left side. The queries cover concepts like selecting data from tables, filtering results, aggregations, and date/string functions.
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)
65 views

IP Fair Rec

The document contains details of 5 queries sets practiced on different dates regarding fetching records from databases, functions, DDL commands, and group by and order by clauses. Each query set contains multiple queries with the aim, source code, and output to be written in a table on the left side. The queries cover concepts like selecting data from tables, filtering results, aggregations, and date/string functions.
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
You are on page 1/ 7

Date Topic Date Signature of the

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.

a) Display all information from movie.


b) Display the type of movies.
c) Display movieid, moviename, total_eraning by showing the business done by the movies. Calculate the
business done by movie using the sum of productioncost and businesscost.
d) Display movieid, moviename and productioncost for all movies with productioncost greater thatn 150000
and less than 1000000.
e) Display the movie of type action and romance.
f) Display the list of movies which are going to release in February, 2022.

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

b) select distinct from a movie;


Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
c) select movieid, moviename, productioncost + businesscost "total earning" from movie;
Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
d)select movie_id,moviename, productioncost
from movie
where product is >150000 and and <1000000;

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:

Aim: Write following queries:


a) Write a query to display cube of 5.
b) Write a query to display the number 563.854741 rounding off to the next hnudred.
c) Write a query to display "put" from the word "Computer".
d) Write a query to display today's date into DD.MM.YYYY format.
Source Code:
a)select pow(5,3);

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

d)select concat(day(now()), concat('.',month(now()), concat('.',year(now())))) "Date";


Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen
Sno: 3 Date:
Aim:

a) Write a query to display 'DIA' from the word "MEDIA".


b) Write a query to display moviename - type from the table movie.
c) Write a query to display first four digits of productioncost.
d) Write a query to display last four digits of businesscost.
e) Write a query to display weekday of release dates.
f) Write a query to display dayname on which movies are going to be released.

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:

Aim: Consider the following table and write the queries:

a) Display all the items in the ascending order of stockdate.


b) Display maximum price of items for each dealer individually as per dcode from stock.
c) Display the sum of quantity for each dcode.

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

b) select dcode,max(unitprice) from stock group by code;


Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen

c) select dcode,sum(qty) from stock group by dcode;


Output: In the Left hand side-Opposite to the query , draw table with pencil and write content with pen

You might also like