views and Things

Source: Internet
Author: User

Statement: The material used in this column is written by the VIP students of the Kay Academy, who has the right to be anonymous and has the final right to interpret the article; The Edith Academy is designed to promote students to learn from each other on the basis of public notes.

views and Things

MySQL in view create delete and modify the statement and create delete modify syntax similar to the table.

The CREATE VIEW syntax is:

CREATE view name as query SQL statement

As follows:

CREATE VIEW Student_view as SELECT s.sname ' student name ', s.address ' contact address ', S.phone ' phone number ', C.cname ' class name ' from student s INNER JOIN CLS C on S.cid=c.cid ORDER by S.sid DESC

NOTE: If the SQL statement inside the view is involved with multiple tables, you cannot DELETE the UPDATE INSERT.

The delete view syntax is:

DROP View Name

Modify the view syntax to:

ALTER view view name as query SQL statement

MySQL transactions allow us to be more secure with data operations in the database. Examples are as follows:

The end of transaction method has commit commit and rollback rollback, commit commit is to write the operation in the transaction to the database permanently, rollback rollback all operation that cancels this transaction.

The automatic transaction Set statement is set Autocommit=1, and each statement is an automatic transaction by default.

The manual things Set statement is set autocommit=0, and we need to enter the start transaction to manually open a transaction.

After the addition and deletion of a manual transaction is executed, it automatically locks the statement and does not give access to other transactions. Other transactions can be accessed only if the transaction ends.

views and Things

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.