Compare SQL Server, Oracle, and DB2 view creation statements.

Source: Internet
Author: User

A view can be simply considered as an alias for a query:

It can restrict data access and simplify queries.

The statements for creating a view are as follows:

 

SQL Server:

Create view empv20 as select * from EMP where deptno = 20; Modify View: Alter view empv20 As select ename From EMP Where deptno = 20;

The statements created on Oracle and DB2 are identical.

• Create or replace view empvu20 • as select * • from EMP • where deptno = 20 you can also add the with check option to protect view integrity: Create or replace view empvu20 As select * From EMP Where deptno = 20 With check option constraint empvu20_ck;

SQL> Update empvu20 Set deptno = 10 Where e-mapreduce = 7788;Update empvu20 * error at line 1: ORA-01402: view with check option where-clause Violation  

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.