0
0
MySQLquery~5 mins

Querying from views in MySQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a view in a database?
A view is like a saved query that looks like a table. It shows data from one or more tables but does not store data itself.
Click to reveal answer
beginner
How do you select data from a view named employee_view?
You use a SELECT statement just like with a table: <br>SELECT * FROM employee_view;
Click to reveal answer
intermediate
Can you update data directly through a view?
Sometimes yes, if the view is simple and based on one table. But complex views or those with joins usually cannot be updated directly.
Click to reveal answer
beginner
Why use views instead of querying tables directly?
Views simplify complex queries, hide sensitive columns, and provide a consistent way to look at data.
Click to reveal answer
beginner
Write a simple SQL to create a view named active_customers showing customers with status 'active'.
CREATE VIEW active_customers AS SELECT * FROM customers WHERE status = 'active';
Click to reveal answer
What does a view in SQL represent?
AA stored table with data
BA backup of the database
CA saved query that looks like a table
DA user account
Which SQL command is used to get data from a view named sales_view?
ASELECT * FROM sales_view;
BGET * FROM sales_view;
CSHOW sales_view;
DREAD sales_view;
Can you always update data through a view?
AYes, always
BNo, never
COnly if the view has more than one table
DOnly if the view is simple and based on one table
Why might you use a view instead of querying tables directly?
ATo hide sensitive data and simplify queries
BTo make queries more complex
CTo store data permanently
DTo delete data faster
Which of these is the correct syntax to create a view?
ACREATE TABLE view_name AS SELECT ...;
BCREATE VIEW view_name AS SELECT ...;
CMAKE VIEW view_name SELECT ...;
DNEW VIEW view_name AS SELECT ...;
Explain what a database view is and why it is useful.
Think about how a view acts like a window to data.
You got /4 concepts.
    Describe how to query data from a view and mention any limitations on updating data through views.
    Consider how views behave like tables but with some restrictions.
    You got /4 concepts.