0% found this document useful (0 votes)
9 views

University of Lahore: Department of Software Engineer

The document discusses when views in a database should be refreshed. It explains that views are a logical virtual table created by a select query, and the result is not stored on disk. Every time the data is needed, the latest data is retrieved from the original tables by firing the query again. The performance of a view depends on the select query used to define it. Views allow storing the query definition in the database itself. It then provides 7 rules for when a view can be updated.

Uploaded by

Hannan Butt
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

University of Lahore: Department of Software Engineer

The document discusses when views in a database should be refreshed. It explains that views are a logical virtual table created by a select query, and the result is not stored on disk. Every time the data is needed, the latest data is retrieved from the original tables by firing the query again. The performance of a view depends on the select query used to define it. Views allow storing the query definition in the database itself. It then provides 7 rules for when a view can be updated.

Uploaded by

Hannan Butt
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

University of Lahore

Department of Software Engineer

Assignment#7
Spring Semester, 2020
Due Date: 10 May 2020

Course: Distributed Database Systems


Section: S
Instructor: Zahoor Ahmad Khan

Question 1. When should a View be refreshed? Explain in detail

Answer : Views in Database:

Views are a logical virtual table created by “select query” but the result is not stored anywhere in the disk and

every time we need to fire the query when we need data, so always we get updated or latest data from original

tables. Performance of the view depends on our select query. If we want to improve the performance of view we

should avoid using join statement in our query or if we need multiple joins between table always try to use the

index based column for joining as we know index based columns are faster than a non-index based column.

View also allows storing the definition of the query in the database itself.

1. The view is defined based on one and only one table.

2. The view must include the PRIMARY KEY of the table based upon which the view has been created.

3. The view should not have any field made out of aggregate functions.

4. The view must not have any DISTINCT clause in its definition.

5. The view must not have any GROUP BY or HAVING clause in its definition.

6. The view must not have any SUBQUERIES in its definitions.

7. If the view you want to update is based upon another view, the later should be updatable.

8. Any of the selected output fields (of the view) must not use constants, strings or value expressions.

You might also like