When you open a view in navicat for MySQL, you are prompted that the view does not have a primary key problem

Source: Internet
Author: User

The view is always interpreted as a SELECT statement, and the view is typically used for queries that do not update the data of the table or view itself through the view, so the view does not need a primary key at all. I built a view of myself today View_test:

Drop View if existsview_testCreate Viewview_test asSelectA.C1,A.C2,B.C1,B.C2,C.C1,C.C2,D.C1,D.C2 fromtable_a AJoinTeble_b B onA.c3=b.c3JoinTable_c C onB.c4=c.c4JoinTable_d D onC.c5=d.c5whereD.c6inch (SelectC6 fromTable_ewhereC5=(SelectC5 fromTable_dwhereC7='123321'))Order  byA.c1

When you open this view in Navicat of MySQL, the following hint pops up (the graph on the net, the first line of the V_sys_user is the name of the view you created), saying that the view does not have a primary key, but can query the results of the view normally.

Later in http://blog.csdn.net/wufengui1315/article/details/11620393

Here it is said that using a join or a where subquery if the table in the FROM clause is used, the prompt is reported, so I remove the WHERE clause and change it to:

Drop View if existsview_testCreate Viewview_test asSelectA.C1,A.C2,B.C1,B.C2,C.C1,C.C2,D.C1,D.C2 fromtable_a AJoinTeble_b B onA.c3=b.c3JoinTable_c C onB.c4=c.c4JoinTable_d D onC.c5=d.c5Order  byA.c1

The result is still reported the same cue box, and then accidentally ignored the "order by A.c1" This line to execute the above statement, when opened, there is no such hint, and then add the WHERE clause back, but the order by statement is removed, open will not error, indicating the problem in the ORDER BY clause, Instead of where or join. Just get rid of the ORDER by statement .

In addition, the view statement of the error (including the order BY statement), opened in Navicat for MySQL will be reported prompt, but with the MySQL Workbench Open will not, indicating that this is not a big problem.

When you open a view in navicat for MySQL, you are prompted that the view does not have a primary key problem

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.