Database View Usage
View
By using views, we can string together items to be used from multiple tables into a virtual table. Calling the virtual table can simplify the complexity of statements.CREATE VIEW view Create viewDROP VIEW view Drop view
If you need to update a view, you can delete it first and then create it anew, or use CREATE OR REPLACE VIEW view to update it. The statement means if a view with the same name exists, overwrite it; otherwise, create a virtual table.
When using views, we should avoid creating too many view joins. When using multiple view joins, we need to test the running time.
code:
1 | drop view generalview; |
Typically found an error when calling subgeneralerrorunits.sgeu_id today, my brain wasn’t working at that time.
At this point, our view is a virtual table. If we still use the previous index, a column not found error will occur. Inputting the corresponding name directly (as shown in the table below) will allow normal operation.

