How is a database view different from tables?

1 answer

Answer

1251062

2026-05-14 00:35

+ Follow

A database view is a dynamic table compared to the 'fixed' ones.

A view contains a select statement, which dynamically updates the table everytime the view is looked at and the data has changed. Since these queries are compiled they will be faster than normal queries.

Example:

Table A:

ID, Integer

FullName, String

Table B:

AID, Integer

Address, String

You would like to find the address for each person.

Instead of making a long select each time you want a specific address for a specific person. You could make a select, that joins the data, make it into a view, and then use the View afterwards. Like:

SELECT a.id, a.fullname, b.address FROM a, b WHERE a.id = b.aid;

This will be your view, tView. Now the data:

SELECT * FROM tView WHERE fullname = 'John Randomness'.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.