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