🗄️ Database Design / Normalization
Beginner
What is the difference between a table and a view?
Answer
A table physically stores data on disk — rows are persisted and occupy storage. DML operations (INSERT, UPDATE, DELETE) directly modify the underlying data. Tables are the primary storage unit in a relational database. A view is a virtual table defined by a SELECT query — it stores the query definition, not the data. When you query a view, the database executes the underlying SELECT dynamically. Views cannot (usually) be directly inserted/updated unless they are simple views on a single table with no aggregations. Views abstract complexity, provide security by limiting column/row exposure, and simplify repeated complex queries.