Bird
0
0

Given the table Orders with columns order_id, customer_id, and amount, what will the following SQL view return?

medium📝 query result Q4 of 15
SQL - Views
Given the table Orders with columns order_id, customer_id, and amount, what will the following SQL view return?

CREATE VIEW LargeOrders AS SELECT order_id, amount FROM Orders WHERE amount > 1000;

SELECT * FROM LargeOrders;
AAll orders with amount greater than 1000
BAll orders with amount less than 1000
CAll orders regardless of amount
DAn error because views cannot filter data
Step-by-Step Solution
Solution:
  1. Step 1: Understand the view definition

    The view LargeOrders selects order_id and amount from Orders where amount is greater than 1000.
  2. Step 2: Analyze the SELECT from the view

    Selecting all from LargeOrders returns only rows matching the WHERE condition in the view.
  3. Final Answer:

    All orders with amount greater than 1000 -> Option A
  4. Quick Check:

    View filters rows with amount > 1000 = All orders with amount greater than 1000 [OK]
Quick Trick: Views can filter rows using WHERE clause [OK]
Common Mistakes:
MISTAKES
  • Thinking views cannot filter data
  • Assuming view returns all rows
  • Confusing greater than and less than

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes