An airline stores ticket sales in a sales table with columns…

An airline stores ticket sales in a sales table with columns flight_number and amount. The finance team wants to know the total revenue per flight. Which SQL should they use? SELECT flight_number, SUM(amount) FROM sales GROUP BY flight_number SELECT SUM(amount) FROM sales SELECT flight_number, amount FROM sales ORDER BY flight_number SELECT flight_number, COUNT(amount) FROM sales GROUP BY flight_number Answer: SELECT flight_number, SUM(amount) FROM sales GROUP BY flight_number Explanation: SUM(amount) calculates total revenue per flight, grouped by flight_number. A plain SUM would only give overall revenue. Ordering by flight number doesn’t summarize. Using COUNT(amount) would return the number of sales, not revenue.

A hospital database includes a table named patients with a c…

A hospital database includes a table named patients with a column called city. The administrator wants to return only patients who live in Chicago. Which query should they write? SELECT * FROM patients WHERE city = Chicago SELECT * FROM patients WHERE city LIKE “Chicago” SELECT * FROM patients WHERE city = ‘Chicago’ SELECT * FROM patients WHERE city IS Chicago Answer: SELECT * FROM patients WHERE city = ‘Chicago’ Explanation: Text values must be enclosed in single quotes in SQL. Using double quotes or omitting quotes would cause errors. The LIKE operator is valid but unnecessary when looking for an exact match.