0% found this document useful (0 votes)
17 views2 pages

sql based_practical -12 nd 13

The document outlines SQL commands for creating a database and a Movies table, including inserting multiple movie records with details such as ID, name, category, release date, production cost, and business cost. It also provides a series of practical exercises to retrieve specific information from the Movies table, such as listing movies without column names, calculating net profit, and filtering by categories and release dates. Additionally, it suggests drawing a diagram to illustrate the execution of the SQL commands.

Uploaded by

namanrathore775
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)
17 views2 pages

sql based_practical -12 nd 13

The document outlines SQL commands for creating a database and a Movies table, including inserting multiple movie records with details such as ID, name, category, release date, production cost, and business cost. It also provides a series of practical exercises to retrieve specific information from the Movies table, such as listing movies without column names, calculating net profit, and filtering by categories and release dates. Additionally, it suggests drawing a diagram to illustrate the execution of the SQL commands.

Uploaded by

namanrathore775
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/ 2

practical - 12

CREATE DATABASE __________;

CREATE TABLE Movies (

MovieID INT PRIMARY KEY,

MovieName VARCHAR(255) NOT NULL,

Category VARCHAR(100),

ReleaseDate DATE,

ProductionCost INT,

BusinessCost INT

);

INSERT INTO Movies (MovieID, MovieName, Category, ReleaseDate, ProductionCost,


BusinessCost)
VALUES (1, 'Action Movie 1', 'Action', '2023-10-26', 10000000, 20000000);

INSERT INTO Movies (MovieID, MovieName, Category, ReleaseDate, ProductionCost,


BusinessCost)
VALUES (2, 'Comedy Movie 1', 'Comedy', '2024-01-15', 5000000, 12000000);

INSERT INTO Movies (MovieID, MovieName, Category, ReleaseDate, ProductionCost,


BusinessCost)
VALUES (3, 'Drama Movie 1', 'Drama', '2023-07-01', 8000000, 15000000);

INSERT INTO Movies (MovieID, MovieName, Category, ReleaseDate, ProductionCost,


BusinessCost)
VALUES (4, 'Sci-Fi Movie 1', 'Sci-Fi', '2024-03-20', 15000000, 25000000);

INSERT INTO Movies (MovieID, MovieName, Category, ReleaseDate, ProductionCost,


BusinessCost)
VALUES (5, 'Romantic Movie 1', 'Romance', '2023-11-05', 6000000, 10000000);

Record the output of this practical exercise and include it on a blank page in your
practical file.
--
like -
+---------+------------------+----------+-------------+----------------
+--------------+
| MovieID | MovieName | Category | ReleaseDate | ProductionCost |
BusinessCost |
+---------+------------------+----------+-------------+----------------
+--------------+
| 1 | Action Movie 1 | Action | 2023-10-26 | 10000000 |
20000000 |
| 2 | Comedy Movie 1 | Comedy | 2024-01-15 | 5000000 |
12000000 |
| 3 | Drama Movie 1 | Drama | 2023-07-01 | 8000000 |
15000000 |
| 4 | Sci-Fi Movie 1 | Sci-Fi | 2024-03-20 | 15000000 |
25000000 |
| 5 | Romantic Movie 1 | Romance | 2023-11-05 | 6000000 |
10000000 |
| 6 | pushpa-2 | action | NULL | 65550 |
180999 |
| 7 | pushpa-2 | action | NULL | 65550 |
NULL |
| 8 | ek the tiger-5 | drama | 2027-04-12 | 43434 |
NULL |
| 9 | ek the tiger-5 | drama | 2027-01-12 | 43434 |
NULL |
+---------+------------------+----------+-------------+----------------
+--------------+
------------------

practical - 13
1 - Retrieve movies informations without mentioning their columns name
2- list business done by Movies showing only movie ID movie name and business cost
3 - list different categories of movies
4 - find the net profit of each movie showing its ID name and net profit
5 - list all movies with production cost greater than 80000 less than 125000
showing ID name and production cost
6 - list all the movies which fall in the category of comedy or action
7 - list all the movies which have not been released yet

--------------

( Draw a diagram illustrating the execution of this command on a blank page in your
practical file.
1 - SELECT * FROM Movies;
2 - SELECT MovieID, MovieName, BusinessCost FROM Movies;
3 - SELECT DISTINCT Category FROM Movies;
4 - SELECT MovieID, MovieName, BusinessCost - ProductionCost AS NetProfit FROM
Movies;
5 - SELECT MovieID, MovieName, ProductionCost FROM Movies WHERE ProductionCost >
180000 AND ProductionCost < 1250008989898;
6 - SELECT MovieID, MovieName, Category FROM Movies WHERE Category = 'Comedy' OR
Category = 'Action';
7 - SELECT MovieID, MovieName, ReleaseDate FROM Movies WHERE ReleaseDate >
CURDATE();

You might also like