A movie rental company has a movies table with title and rel…

A movie rental company has a movies table with title and release_year. The manager wants to see the movies listed from the newest to the oldest release year. Which SQL query should they run? SELECT * FROM movies ORDER BY release_year ASC SELECT * FROM movies ORDER BY release_year DESC SELECT release_year FROM movies SELECT * FROM movies GROUP BY release_year Answer: SELECT * FROM movies ORDER BY release_year DESC Explanation: DESC sorts in descending order, so the most recent release years appear first. ASC would list from oldest to newest. Selecting only release_year shows one column without sorting all movies, and GROUP BY is not a sorting tool.

A car rental company has a rentals table with columns car_ty…

A car rental company has a rentals table with columns car_type and days_rented. The operations team wants to know the longest rental period for each car type. Which SQL query should they use? SELECT car_type, MAX(days_rented) FROM rentals GROUP BY car_type SELECT car_type, days_rented FROM rentals ORDER BY days_rented DESC SELECT MAX(days_rented) FROM rentals SELECT car_type, SUM(days_rented) FROM rentals GROUP BY car_type Answer: SELECT car_type, MAX(days_rented) FROM rentals GROUP BY car_type Explanation: MAX(days_rented) finds the longest rental per car type when grouped accordingly. Simply ordering by days_rented shows all rentals but not summaries. A plain MAX(days_rented) gives the longest rental overall, not per type. SUM(days_rented) would calculate totals, not maximums.

Why might an organization use a view instead of giving direc…

Why might an organization use a view instead of giving direct access to a full table? To permanently delete unnecessary data To automatically increase query performance To restrict access to only part of the table To replace the need for indexes Answer: To restrict access to only part of the table Explanation: Views can hide sensitive columns or rows, allowing controlled access. They don’t automatically boost performance, delete data, or replace indexes.

A bank has an accounts table with (account_id, holder_name,…

A bank has an accounts table with (account_id, holder_name, balance). They want to add a new account with ID 5001, holder name Emma, and starting balance 1000.00. Which SQL is correct? INSERT accounts VALUES (5001, ‘Emma’, 1000.00); INSERT INTO accounts VALUES (5001, ‘Emma’, 1000.00); ADD INTO accounts (5001, ‘Emma’, 1000.00); UPDATE accounts (5001, ‘Emma’, 1000.00); Answer: INSERT INTO accounts VALUES (5001, ‘Emma’, 1000.00); Explanation: The correct syntax is INSERT INTO … VALUES. The others misuse SQL commands (INSERT, ADD, UPDATE).