KEMBAR78
LabTask Database 12 Week | PDF
0% found this document useful (0 votes)
7 views4 pages

LabTask Database 12 Week

The document outlines a lab task submission for a Database course at the National University of Modern Languages, Faisalabad Campus. It includes SQL code for creating a database named 'movie3', a table for movies, and various queries to retrieve data based on specific criteria. The queries demonstrate the use of subqueries to filter movies by genre, release year, and director.
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)
7 views4 pages

LabTask Database 12 Week

The document outlines a lab task submission for a Database course at the National University of Modern Languages, Faisalabad Campus. It includes SQL code for creating a database named 'movie3', a table for movies, and various queries to retrieve data based on specific criteria. The queries demonstrate the use of subqueries to filter movies by genre, release year, and director.
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/ 4

National University of Modern Languages

Faisalabad Campus
Department of Computer Science

Submitted to Mam. Ayesha Ayub


Submitted by M Haseeb-Ur-Rahman
Subject: Database
Roll no FC-354
LabTask 12
Code of Q:
create database movie3;

use movie3;

create table movies (

movie_id int,

title varchar(100),

release_year int,

genre varchar(50),

director varchar(100)

);

insert into movies (movie_id, title, release_year, genre, director) values (1, 'Inception', 2010, 'Sci-
Fi', 'Christopher Nolan');

insert into movies (movie_id, title, release_year, genre, director) values (2, 'The Matrix', 1999,
'Action', 'Wachowskis');

insert into movies (movie_id, title, release_year, genre, director) values (3, 'Interstellar', 2014, 'Sci-
Fi', 'Christopher Nolan');

select * from movies where genre = (select genre from movies where movie_id = 3);

select * from movies where release_year = (select max(release_year) from movies);

select * from movies where release_year = (select min(release_year) from movies);

select * from movies where director = (select director from movies where movie_id= 2);

select * from movies where genre = ( select genre from movies where genre = 'Action');

Sub Query 1:
Sub Query 2:

Sub Query 3:

Sub Query 4:
Sub Query 5:

You might also like