Get the App
SLTechnology News&Howtos  ›  Database  › 

What is the difference between simple views and complex views in SQL

Shulou Source: shulou.com Published: 2022-06-01 03:50:42 10月01日 Update

This article will explain in detail what is the difference between simple view and complex view in SQL, Xiaobian thinks it is quite practical, so share it with you as a reference, I hope you can gain something after reading this article.

A view in SQL as a logical subset of data from one or more tables. Views are used to restrict data access. A view does not contain its own data, but contains a similar window through which you can view or change the data in the table. The table on which the view is based is called the base table.

SQL has two types of views: simple views and complex views.

A simple view can contain only a single base table. Complex views can be constructed on multiple base tables.

Complex views can contain: join conditions, group by clauses, order by clauses.

The main differences between these views are:

Simple view Complex view contains only one base table or is created from only one table. Contains or creates from multiple base tables. We can't use MAX (), COUNT (), etc. We can use the group function. Does not contain data sets. It protects data sets. DML operations can be performed through simple views. DML operations cannot always be performed through complex views. INSERT, Delete, and UPDATE can be performed directly on simle views. We cannot directly apply INSERT, Delete, and UPDATE to complex views. Simple views do not contain group by, distinct, pseudocolumn such as rownum, columns defy by expressions. It can contain group by, distinct, pseudocolumn such as rownum, columns defy by expression. NOT NULL columns in base tables are not included. NOT NULL columns not selected by a simple view can be included in a complex view. What is the difference between simple view and complex view in SQL? I hope the above content can help you and learn more. If you think the article is good, you can share it so that more people can see it.

Tags: Views complexity data multiple functions clauses more articles good practical between content single can be passed subsets articles conditions knowledge types opinions Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Redmi Linux Shulou Technology Shulou Tech Info