MySql queries

 

PART B – SQL QUERIES

1.  Queries 

PART B – SQL QUERIES

1.  Queries Set 1 (Database Fetching records)

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_earning by showing the business done by the movies. Calculate total_earning using the sum of productioncost and businesscost.


 

 

d)      Display movieid, moviename and productioncost for all movies with productioncost greater than 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.



2.  Queries Set 2 (Based on Functions)

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 hundred.


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.


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



f)   Write a query to display moviename - type from the table movie.


g)   Write a query to display first four digits of productioncost.


h)  Write a query to display last four digits of businesscost.



i)   Write a query to display weekday of release dates.


j)   Write a query to display dayname on which movies are going to be released.



 Set 1 (Database Fetching records)

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_earning by showing the business done by the movies. Calculate total_earning using the sum of productioncost and businesscost.


 

 

d)      Display movieid, moviename and productioncost for all movies with productioncost greater than 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.



2.  Queries Set 2 (Based on Functions)

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 hundred.


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.


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



f)   Write a query to display moviename - type from the table movie.


g)   Write a query to display first four digits of productioncost.


h)  Write a query to display last four digits of businesscost.



i)   Write a query to display weekday of release dates.


j)   Write a query to display dayname on which movies are going to be released.



 

Comments

Popular posts from this blog

Binary file update using Python program