Bird
0
0

You want to create a view that shows only active customers with their total orders, but the Orders table has millions of rows. Which approach best uses views to improve performance and security?

hard📝 Application Q15 of 15
SQL - Views
You want to create a view that shows only active customers with their total orders, but the Orders table has millions of rows. Which approach best uses views to improve performance and security?
ACreate a view that deletes inactive customers from the database
BCreate a view selecting all customers and orders without filters
CCreate a view filtering active customers and pre-aggregating order totals
DCreate a view that stores all orders physically to speed queries
Step-by-Step Solution
Solution:
  1. Step 1: Understand the goal for the view

    The view should show only active customers and their total orders to reduce data size and protect inactive data.
  2. Step 2: Choose the best approach for performance and security

    Filtering and pre-aggregating in the view reduces data scanned and hides unnecessary info, improving speed and security.
  3. Final Answer:

    Create a view filtering active customers and pre-aggregating order totals -> Option C
  4. Quick Check:

    Filter and aggregate in view for speed and security = A [OK]
Quick Trick: Filter and aggregate in views to improve speed and hide data [OK]
Common Mistakes:
MISTAKES
  • Selecting all data without filters
  • Trying to delete data via views
  • Misunderstanding views store data physically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes