Questions
10 of 17
1What is a View in MySQL?
2How do you create a View in MySQL?
3Can you update data through a View?
4What is the difference between a View and a Table?
5Untitled question
6Untitled question
7Untitled question
8How does MySQL handle changes to the underlying tables used in a View?
9What are the limitations of Views in MySQL (e.g., regarding indexes or subqueries)?
10What is the difference between a simple View and a complex View?
11Explain how MySQL resolves column name conflicts when a View is created from multiple tables.
12How does the WITH CHECK OPTION clause work in MySQL Views, and what are its implications? Can you nest Views in MySQL? What are the performance considerations when doing so? How can you use Views to enforce data security or restrict user access to sensitive columns? Describe how query optimization works when using Views — does MySQL always materialize them?
13How does the WITH CHECK OPTION clause work in MySQL Views, and what are its implications? Can you nest Views in MySQL? What are the performance considerations when doing so? How can you use Views to enforce data security or restrict user access to sensitive columns? Describe how query optimization works when using Views — does MySQL always materialize them?
14How does MySQL handle permissions when granting access to a View versus its base tables?
15What are the trade-offs between using a View and creating a stored procedure for data abstraction?
16Can you create an updatable View that contains aggregate functions or GROUP BY clauses? Why or why not?
17In what situations might using Views degrade performance, and how can you optimize such scenarios?
10 / 17

What is the difference between a simple View and a complex View?

Difference Between Simple View and Complex View

In MySQL, views can be categorized into simple and complex based on their query structure and whether they can be updated.

Simple View
  1. 1

    Based on a single table.

  2. 2

    Does not contain JOINs, GROUP BY, DISTINCT, UNION, or subqueries.

  3. 3

    Usually updatable (INSERT, UPDATE, DELETE allowed).

  4. 4

    Provides direct access to underlying table columns.

  5. 5

    Easier to maintain and faster in performance.

Example of a Simple View
Complex View
  1. 1

    Based on multiple tables or advanced SQL operations.

  2. 2

    May include JOINs, GROUP BY, DISTINCT, UNION, or subqueries.

  3. 3

    Usually NOT updatable due to derived or aggregated data.

  4. 4

    Useful for reporting and abstraction of complex logic.

  5. 5

    Performance may be slower because of complex calculations.

Example of a Complex View
Difficulty: 5/10
Topics: view definition, performance, maintenance

Scenario Questions

0-2 years experience
  1. 1

    Suppose you need to expose only the email column from the users table to a reporting tool. How would you create a view, and would you consider it a simple or complex view?

  2. 2

    If you add a new column to the underlying table, what happens to an existing simple view that selects *? How would you verify it still works?

  3. 3

    You have a view that selects first_name and last_name from employees. If you query the view with a WHERE clause on salary, what does MySQL do under the hood?

2-5 years experience
  1. 1

    Your team built a view that joins orders and customers and aggregates total spend per customer. It’s running slowly. Walk me through how you’d diagnose whether it’s a simple vs complex view issue.

  2. 2

    We tried to add a GROUP BY to an existing simple view and got an error about non‑deterministic columns. Why did that happen, and how would you refactor the view?

  3. 3

    During a deployment, a change to the products table broke a view that was used by several services. How would you determine if the view was simple or complex and decide the fix path?

5-8 years experience
  1. 1

    Design a strategy for replacing a set of complex reporting views with a more maintainable solution that scales to billions of rows. What trade‑offs do you consider between materialized views, indexed views, and query rewriting?

  2. 2

    Our analytics pipeline relies on a complex view that joins ten tables and uses window functions. Under heavy load, the view causes lock contention. How would you redesign it, and what role does view complexity play in your decision?

  3. 3

    Explain how MySQL’s optimizer treats simple vs complex views differently, and how you’d use EXPLAIN to verify that a complex view isn’t causing a full table scan.

8+ years experience
  1. 1

    We are migrating a legacy monolith to microservices, and many services depend on a library of complex MySQL views. How would you approach refactoring or deprecating these views while ensuring backward compatibility?

  2. 2

    At a large e‑commerce company, you need to decide whether to keep critical reporting logic in complex views or move it to an ELT pipeline. Discuss the long‑term architectural implications, including schema evolution, testing, and data latency.

  3. 3

    Your organization wants to enforce a policy that all new views must be simple unless a documented performance case exists. How would you implement governance, tooling, and review processes to enforce this at scale?

Follow-up Questions

  • What performance impact can a complex view have compared to a simple view?
  • How does MySQL decide whether to materialize a view during query execution?
  • Can you describe a situation where a simple view caused unexpected results?