Mid SQL

How do views differ from tables?

  • Data Storage:
  • Table: Stores actual data in the database.
  • View: A virtual table that shows data from one or more tables but does not

store data. It derives its data from the underlying tables each time it is

queried.

  • Modifications:
  • Table: You can insert, update, or delete data directly.
  • View: You cannot modify data in a view unless certain conditions are met.

Some views (those based on a single table) are updatable, while others

(especially those with JOINs, aggregations, or complex logic) are not.

  • Performance:
  • Table: Generally optimized for performance with indexes, data distribution,

and so on.

  • View: May have slower performance due to the query being executed each

time the view is accessed, especially if it's a complex view or involves large

datasets.

More from SQL Server Tutorial

All questions for this course