Home >Database >Mysql Tutorial >The difference between simple views and complex views in SQL
Before discussing simple views and complex views, we should first know what a view is. A view is a logical virtual table created from one or more tables and is primarily used to extract columns from one or more different tables at a time. Depending on the tables involved in the view, we can distinguish between simple views and complex views in SQL.
The following are the important differences between simple views and complex views.
Serial number | Keywords | Simple view | Complex view |
---|---|---|---|
1 | Definition | A simple view is a view that involves only a single table. In other words, in SQL, a simple view has only one base table. | On the other hand, a complex view is a view involving multiple tables, that is, multiple tables are projected in the complex view. |
2 | Association | In a simple view, since there is only one table in the context, there is no need to apply a primary association in SQL. | On the other hand, in a complex view, since there are multiple tables in the context, general associations need to be applied, including join conditions, grouping conditions, and sorting conditions. |
3 | Group function | In a simple view, since there is only one table, we cannot use grouping functions such as MAX() and COUNT() . | On the other hand, in complex views, since there are multiple tables, we can use various grouping functions. |
4 | Allowed operations | In simple view, DML operations can be easily performed. | However, in complex views, it is not always possible to perform DML operations. |
5 | Modification | As mentioned above, insertion, deletion and update can be done directly due to DML operations. | However, in complex views, we cannot apply insertion, deletion and update. |
6 | Empty columns | In a simple view, you cannot include non-empty columns from the base table. | However, in complex views, non-null columns can be included. |
The above is the detailed content of The difference between simple views and complex views in SQL. For more information, please follow other related articles on the PHP Chinese website!