Home  >  Article  >  Database  >  What are the prerequisites before starting to write and use MySQL views?

What are the prerequisites before starting to write and use MySQL views?

王林
王林forward
2023-08-29 18:45:081003browse

开始编写和使用 MySQL 视图之前有哪些先决条件?

MySQL version

We know that MySQL 5 introduces views, so before we start writing, we first need to check the version of MySQL and use stored procedures. This can be done through the following query -

mysql> Select VERSION();
+-----------+
| VERSION() |
+-----------+
| 5.7.20    |
+-----------+
1 row in set (0.10 sec)

Current user's permissions

In fact, the CREATE VIEW statement requires CREATE VIEW permissions. The permissions of the current user can be checked using the following query -

mysql> SHOW PRIVILEGES

Select Database

Before creating the view, we have to select a database from the available databases. This can be done with the help of the following query -

mysql> USE query;
Database changed

From the above query, it is obvious that we are using the database named "query".

The above is the detailed content of What are the prerequisites before starting to write and use MySQL views?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete