I'm having a hard time trying to create a view in phpMyAdmin. I have a database named myDB
and a table named myTable
.
In phpMyAdmin I click on the SQL tab, type in :
SHOW CREATE VIEW myView;
I got this error MySQL
said:
#1146 - Table 'myTable.myView' doesn't exist
I don't understand this error message at all, of course it doesn't exist, otherwise why would I want to create it in the first place? And why wouldn't mySQL
allow me to create it? How do I create a view?
Thanks
SHOW CREATE VIEW
The syntax you are using is not for creating view in SQL. it is to show the views you have created in SQL
You need to use the following syntax to create a view
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition