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