Database Reference
In-Depth Information
The right panel's menu may look similar to that of a table. However, when necessary,
phpMyAdmin generates the appropriate syntax for handling views. For example, a
click on Drop would produce:
Do you really want to: DROP VIEW 'book_author'
At this point, we can confirm (or not) this view's deletion.
To perform actions on existing views, a user needs to have the
appropriate privilege at the view level, but not necessarily any privilege
on the tables involved in this view. This is how we can achieve column
and table hiding.
Creating a view from results
Creating a complex view may require typing the complete statement into a query
box. Another possibility is to take advantage of phpMyAdmin's Search (at the table
level) or Query (at the database level) features to build a rather complex query,
execute it, and then easily create a view from the results. We'll see how this is done.
We mentioned that a view can be used to limit the visibility of columns (and
in fact, of tables). Let's say that the number of pages in a book is highly
classified information. We open the book table, click Search , and choose a subset
of the columns:
Clicking Go produces a results page, where we see a CREATE VIEW link in the
Query results operations section. We use this link to access the view creation
panel, which already has the underlying query in the AS box. We need to choose
a name for this view (here book_public_info ), and we can optionally set different
column names for it (here number, title ). The other options can influence the view's
behavior, and have been explained in the MySQL manual ( http://dev.mysql.com/
doc/refman/5.1/en/create-view.html ).
 
Search WWH ::




Custom Search