015. Views (SQL Instance)

Source: Internet
Author: User

--View
--encapsulates a complex query statement that is the view.
--Advantages: Simplifying query statements
--eg
CREATE VIEW Emp_view
As
Select Ename as name, job as work, Sal as salary,
Dname as department from EMP INNER join DEPT
On EMP. Deptno=dept. DEPTNO
WHERE sal>2500

SELECT * from Emp_view
WHERE Salary >2000
-----------------------------------------------
-What exactly is in the view??
--. result set
--. SELECT statement
--All the data is from the original table, and there is no data in the view.
--If you modify (edit) The data in the view, it boils down to changing the data in the original table.

--Conclusion: only data that can be traced back to the original table can be modified in the view, and most views cannot be modified. The functionality of the view (if you want to modify the best operation for the original table) is mainly reflected in the query

015. Views (SQL Instance)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.