SQL Queries
SQL Queries
SQL Queries
ONE TABLE
Consider the following MOVIE table and write
the SQL queries based on it:-
The Kashmir
M001 Action 2022/01/26 1245000 1300000
Files
Looop
M003 Thriller 2022/02/01 250000 300000
Lapeta
Shabaash
M005 Biography 2022/02/04 1000000 800000
Mithu
Answers-
[1] select * from movie;
Output:
[2] select distinct from a movie;
Output:
Output:
[4] select movie_id,moviename, productioncost from
movie where producst is >150000 and <1000000;
Output:
Output:
[6] select moviename from moview where
month(releasedate)=2;
Output:
Questions:
1. Write a query to display cube of 5.
2. Write a query to display the number 563.854741 rounding off
to the next hundred.
3. Write a query to display “put” from the word “Computer”.
4. Write a query to display today’s date into DD.MM.YYYY
format.
5. Write a query to display ‘DIA’ from the word “MEDIA”.
6. Write a query to display moviename – type from the table
movie.
7. Write a query to display first four digits of productioncost.
8. Write a query to display last four digits of businesscost.
9. Write a query to display weekday of release dates.
Answers:
Output:
[2] select round(563.854741,-2);
Output:
Output:
[4] Select
concat(day(now()),concat(‘.’,month(now()),concat(‘.’,year(n
ow())))) “Date”;
Output:
Output:
[6] select concat(moviename,concat(‘ – ‘,type)) from movie;
Output:
Output:
[8] select right(businesscost,4) from movie;
Output:
Output:
[10] select dayname(releasedate) from movie;
Output: