Skip to content
BENIBIX Learn

Database View vs Database Table

People think a view is a copy of a table, and it is not. A table holds rows of its own on disk. A view holds no rows at all. It is a saved query with a name, and it runs fresh each time you read it. Change a row in the table, and the view shows the change at once.

Development🗃️ Databases

Database View

A saved query you can read from as if it were a table.

A database view is a saved query that you can use as if it were a table. It stores no data of its own. Each time you read from it, the database runs the query behind it. Views hide hard joins behind a simple name, and they can show some columns while hiding others. You read from a view with SELECT, just like a table.

Example
Lucy's team keeps asking for this month's paid orders. She saves the query as a view called paid_orders, and everyone uses that.
Why it matters
Views let people use a hard query without writing it. They can also hide private columns.
Full entry
Development🗃️ Databases

Database Table

One kind of data in a database. It is set out in rows and columns.

A table is where a database keeps one kind of thing, like customers or orders. It has columns, which say what each record holds, and rows, which are the records. Every row in a table has the same columns. A database usually has many tables that point to each other. Choosing good tables is the first step in designing a database.

Example
Jack's shop has a customers table and an orders table. Each order row points to the customer who placed it.
Why it matters
Tables give data a fixed shape. That shape is what makes searching and checking it reliable.
Full entry

In one line

Database View
A saved query you can read from as if it were a table.
Database Table
One kind of data in a database. It is set out in rows and columns.