MySQL database: Self-correlating, view, Thing, index

Source: Internet
Author: User
Tags create index

Self-correlating query (self ID associated with its own ID (primary key), the query can be logically divided into two tables, and then a separate alias to distinguish)

SELECT * FROM areas as City
Inner join areas as provinces on Provinces.id=city.pid
Where Provinces.title= ' Shanxi province '


Views: Encapsulation of query statements.

Create View V_stu_cla_sco as (followed by query statements, note and query different is field cannot be duplicated)
Select Stu.name,class.title,scores.score from Scores
Inner join Stu on Scores.stuid=stu.id
INNER JOIN class on scores.classid=class.id;

Modify the view: replace Create with Alter


Things: Four properties of acid (atomicity, consistency, isolation, durability)

Open: Begin; Commit commit; Roll back the rollback;


Index: View show index from table name

Creating index: Create index name on table name (field name (word length));

Delete index: Drop the index name on table name;

MySQL database: Self-correlating, view, Thing, index

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.