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

Movie Database Management Exercise

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)
21 views2 pages

Movie Database Management Exercise

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

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();

Common questions

Powered by AI

The SQL statement 'SELECT * FROM Movies;' retrieves all the columns of data from the 'Movies' table. This operation is straightforward as it doesn't involve conditions, but it can be inefficient regarding database performance when a table contains a large number of columns or rows. By fetching all data indiscriminately, it may lead to unnecessary data transfer and increased I/O load, which can affect performance, particularly in larger datasets or when executed repeatedly .

Sorting movies into 'Comedy' or 'Action' using the query 'SELECT MovieID, MovieName, Category FROM Movies WHERE Category = 'Comedy' OR Category = 'Action';' streamlines data retrieval for targeted genre marketing or analysis. However, it may exclude non-listed categories, potentially leading to oversight or mismanagement if broader data is required. Market trends and genre cross-over appeal may not be fully captured in dichotomous categorizations, emphasizing a need for versatile queries capable of multivariable assessments .

Using 'SELECT DISTINCT Category FROM Movies;' identifies unique movie categories, highlighting dataset diversity without redundant data through removing duplicates in results. This aids understanding in areas such as genre distribution and assists in normalization processes, which involve structuring a database to minimize redundancy and dependency. By ensuring distinct entries, database design is optimized for efficient querying and data integrity .

Maintaining accurate movie metadata, covering production details, release dates, and financial outcomes, supports data-driven decision-making by providing a comprehensive historical record. This aids strategic planning and forecasting, enabling informed decisions on project selection, risk assessment, and marketing strategies. High data integrity ensures insights drawn are reliable, fostering adaptability and precision in competitive film markets .

Logical errors can occur in SQL queries due to misalignment between query conditions and dataset constraints. For example, using 'WHERE ProductionCost > 180000 AND ProductionCost < 1250008989898' seems to set an impractically large upper boundary, suggesting a possible typographical error or miscalculation in intended bounds. It can be corrected by verifying logical consistency with realistic dataset constraints, possibly by adjusting to a more feasible upper limit .

Calculating net profit, defined as BusinessCost minus ProductionCost, provides a straightforward measure of a movie's financial success. It allows assessing which productions were cost-effective compared to their gross earnings. Further analysis could involve comparing net profits across genres or examining trends over time to optimize strategies and provide insights into financial planning for future projects .

Erroneous or incomplete data entries, such as NULL values in 'Movies,' can skew analyses and reports, resulting in inaccurate insights or decisions. For example, missing business costs prevent accurate profit calculations and financial performance tracking. Database operations may encounter NULL values as unexpected cases, requiring additional handling logic, potentially increasing complexity and costs in data processing and cleaning efforts .

Retrieving unreleased movies with 'SELECT MovieID, MovieName, ReleaseDate FROM Movies WHERE ReleaseDate > CURDATE();' provides insights into future releases and helps in scheduling, marketing, and resource planning. It allows database managers to keep track of upcoming films efficiently and allocate necessary promotional efforts or inventory management. This foresight aids in strategic decision-making and helps prioritize ongoing campaigns targeting upcoming launches .

Using SQL to filter and assess production costs, such as with 'SELECT MovieID, MovieName, ProductionCost FROM Movies WHERE ProductionCost > 180000;', allows for targeted cost management by identifying high-expense projects. This can facilitate budget reviews and ensure financial resources are allocated effectively. Continuous monitoring via SQL queries assists in recognizing trends and outliers in production spending, enhancing budget forecasts and efficiency, ultimately driving competitive advantage in budget planning .

When using 'INSERT INTO' statements, it is crucial to ensure the accuracy and completeness of data, including unique or primary key constraints, such as MovieID, to prevent duplicate entries. Consistency in the data type and format, like dates and integers, must be maintained. It is also essential to account for NULL values appropriately, ensuring they are intentional and handled correctly, such as checking business or production costs that may not be populated entirely .

You might also like