0% found this document useful (0 votes)
8 views1 page

SQ4

The document contains SQL queries to retrieve information from movie databases tables. It includes queries to get actor names for a specific movie, director names who have directed 2 or more movies, movies with the same runtime, director name for movies of a specific actor, and movies where the hero or heroine's name starts with A.

Uploaded by

Purvesh Gosalia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

SQ4

The document contains SQL queries to retrieve information from movie databases tables. It includes queries to get actor names for a specific movie, director names who have directed 2 or more movies, movies with the same runtime, director name for movies of a specific actor, and movies where the hero or heroine's name starts with A.

Uploaded by

Purvesh Gosalia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

SQ4A - DISPLAY ACTOR FNAME,LNAME,ROLE WHERE MOVIE TITLE IS 'PADMAVAT'

- SELECT ACT_FNAME,ACT_LNAME,ROLE
FROM ACTOR A1,MOVIE M1,STARS S1
WHERE A1.ACT_ID=S1.ACT_ID
AND S1.MOV_ID=M1.MOV_ID
AND M1.MOV_TITLE='PADMAVAT';

SQ4B - SQ4B display the director name and count of movies directed by them
DISPLAY ONLY IF THEY HAVE DONE 2 OR MORE MOVIES

- SELECT DIR_NAME,COUNT(MOV_ID)
FROM DIRECTOR D LEFT JOIN MOVIE M
ON D.DIR_ID=M.DIR_ID
GROUP BY DIR_NAME
HAVING COUNT(MOV_ID)>=2;

SQ4C - SHOW MOVIES HAVING SAME RUN TIME

- SELECT M.MOV_TITLE,S.MOV_RUN_TIME
FROM MOVIE M,MOVIE S
WHERE M.MOV_RUN_TIME = S.MOV_RUN_TIME AND M.MOV_TITLE != S.MOV_TITLE;

SQ4D - DISPLAY THE DIRECTOR NAME WHO DIRECTED MOVIE OF 'AJITH'

- SELECT D.DIR_NAME,M.MOV_TITLE
FROM DIRECTOR D, MOVIE M, ACTOR A, STARS S
WHERE D.DIR_ID=M.DIR_ID AND M.MOV_ID=S.MOV_ID AND S.ACT_ID=A.ACT_ID
AND A.ACT_FNAME='AJITH';

SQ4E - LIST MOVIES WHERE EITHER THE HERO OR HEROINE'S FNAME STARTS WITH 'A'

- SELECT M.MOV_TITLE, A.ACT_FNAME


FROM MOVIE M, ACTOR A,STARS S
WHERE A.ACT_ID=S.ACT_ID AND S.MOV_ID=M.MOV_ID
AND A.ACT_FNAME LIKE 'A%' AND S.ROLE IN('HERO','HEROINE');

You might also like