Consider the following MOVIE database and answer the SQL queries based on it.
| MovieID | MovieName | Category | ReleaseDate | ProductionCost | BusinessCost |
|---|---|---|---|---|---|
| 001 | Hindi_Movie | Musical | 2018-04-23 | 124500 | 130000 |
| 002 | Tamil_Movie | Action | 2016-05-17 | 112000 | 118000 |
| 003 | English_Movie | Horror | 2017-08-06 | 245000 | 360000 |
| 004 | Bengali_Movie | Adventure | 2017-01-04 | 72000 | 100000 |
| 005 | Telugu_Movie | Action | - | 100000 | - |
| 006 | Punjabi_Movie | Comedy | - | 30500 | - |
a) Retrieve movies information without mentioning their column names.
b) List business done by the movies showing only MovieID, MovieName and BusinessCost.
c) List the different categories of movies.
d) Find the net profit of each movie showing its ID, Name and Net Profit.
(Hint: Net Profit = BusinessCost – ProductionCost)
Make sure that the new column name is labelled as NetProfit. Is this column now a part of the MOVIE relation. If no, then what name is coined for such columns? What can you say about the profit of a movie which has not yet released? Does your query result show profit as zero?
e) List all movies with ProductionCost greater than 80,000 and less than 1,25,000 showing ID, Name and ProductionCost.
f) List all movies which fall in the category of Comedy or Action.
g) List the movies which have not been released yet.
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →Seven classic single-table queries on MOVIE: SELECT * (all columns), a projection list, DISTINCT for categories, a derived column BusinessCost - ProductionCost AS NetProfit (not stored in the relation; NULL — not zero — for unreleased movies), a range with AND, a set filter with IN, and IS NULL for the not-yet-released rows.
A reading note first: the dashes in the table mean the value is NULL (unknown) — ReleaseDate and BusinessCost are NULL for movies 005 and 006. That drives parts (d) and (g).
a) All movie information, without naming columns
SELECT * FROM MOVIE;
| MovieID | MovieName | Category | ReleaseDate | ProductionCost | BusinessCost |
|---|---|---|---|---|---|
| 001 | Hindi_Movie | Musical | 2018-04-23 | 124500 | 130000 |
| 002 | Tamil_Movie | Action | 2016-05-17 | 112000 | 118000 |
| 003 | English_Movie | Horror | 2017-08-06 | 245000 | 360000 |
| 004 | Bengali_Movie | Adventure | 2017-01-04 | 72000 | 100000 |
| 005 | Telugu_Movie | Action | NULL | 100000 | NULL |
| 006 | Punjabi_Movie | Comedy | NULL | 30500 | NULL |
* is exactly the "don't mention the column names" device — it expands to all columns.
b) Business done — only MovieID, MovieName, BusinessCost
SELECT MovieID, MovieName, BusinessCost FROM MOVIE;
| MovieID | MovieName | BusinessCost |
|---|---|---|
| 001 | Hindi_Movie | 130000 |
| 002 | Tamil_Movie | 118000 |
| 003 | English_Movie | 360000 |
| 004 | Bengali_Movie | 100000 |
| 005 | Telugu_Movie | NULL |
| 006 | Punjabi_Movie | NULL |
Listing column names after SELECT projects just those columns.
c) The different categories
SELECT DISTINCT Category FROM MOVIE;
| Category |
|---|
| Musical |
| Action |
| Horror |
| Adventure |
| Comedy |
DISTINCT collapses duplicates — Action appears in two rows but is listed once.
d) Net profit of each movie
SELECT MovieID, MovieName,
BusinessCost - ProductionCost AS NetProfit
FROM MOVIE;
| MovieID | MovieName | NetProfit |
|---|---|---|
| 001 | Hindi_Movie | 5500 |
| 002 | Tamil_Movie | 6000 |
| 003 | English_Movie | 115000 |
| 004 | Bengali_Movie | 28000 |
| 005 | Telugu_Movie | NULL |
| 006 | Punjabi_Movie | NULL |
Three sub-questions hide here:
- Is NetProfit now part of the MOVIE relation? No. It is computed on the fly for this result only;
AS NetProfitmerely labels the output column. Such columns are called derived (computed/virtual) columns — the table itself is unchanged. - Profit of an unreleased movie? Its
BusinessCostis NULL, and any arithmetic with NULL yields NULL — soNULL - 100000is NULL. - Does the result show zero? No — it shows NULL, which is the honest answer: the profit is unknown, not zero.
e) ProductionCost between 80,000 and 1,25,000 (exclusive)
SELECT MovieID, MovieName, ProductionCost
FROM MOVIE
WHERE ProductionCost > 80000 AND ProductionCost < 125000;
| MovieID | MovieName | ProductionCost |
|---|---|---|
| 001 | Hindi_Movie | 124500 |
| 002 | Tamil_Movie | 112000 |
| 005 | Telugu_Movie | 100000 |
AND requires both bounds to hold; 004 (72000) falls below and 003 (245000) above. …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.