MySQL Basics (ii)

Source: Internet
Author: User

First, the View

A view is a virtual table (not a real one), which is the essence of getting dynamic datasets and naming them based on SQL statements. Users can only use "name" to get a result set and use it as a table.

Select *  from (Selectfromwhere course_id=3)  as  where>
temporary table Search

1. Create a View

-- Syntax: --         CREATE VIEW name SQL statement createviewasselect from where course_id=3
Create an instance

2. Delete View

-- Syntax: --         frop View name dropView v1
Delete View V1

3. Modify the View

-- Syntax: --         ALTER VIEW name as SQL statement alterviewasselectfrom where course_id =1  
Modify View v1

4. Using views

When you use a view, you manipulate it as a table, and because the view is a virtual table, you cannot use it to create, update, and delete real tables, only for queries.

Select *  from V1
working with views v1Second, Trigger

Before and after an "Add/delete/change" operation on a table you can use triggers when you want to trigger a particular behavior, which is used to customize the behavior of the user before and after the "Add/delete/change" row of the table.

1. Create basic syntax

MySQL Basics (ii)

Related Article

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.