New Features of MySQL5 (view)

Source: Internet
Author: User

A view is a function that extracts and generates data from a single table or multiple tables connected by JOIN into a new window. There are two reasons for the wide use of the view function by database developers and administrators:
Manage database security
-The view can help protect sensitive data by hiding some sensitive information columns in the meta table. These meta tables can be a single actual table or JOIN tables, restrict the actual data rows that can be returned from these metabases, or decrypt the encrypted data that has been stored on the disk to implement database security management.
Optimize database performance
-A view can be used to optimize database performance. It is a multi-Table view created through a predefined fine-tuned JOIN condition, or, you can limit that only a small amount of data can be returned from a large database table.
The view function supported by MySQL5 can be used to execute certain UPDATE statements using views under certain conditions, so that the data can be updated. The following is an example:

mysql> select * from customer;+-------------+---------------------+--------------------+------------------+| customer_id | customer_first_name | customer_last_name | customer_ssn     |+-------------+---------------------+--------------------+------------------+|           1 | fred                | smith              | ☼Q,U¶  ¢ƒ╠▒4╨☺ö| +-------------+---------------------+--------------------+------------------+ 1 row in set (0.03 sec)mysql> create view v_customer as t_name,    -> select customer_id, customer_first_name, customer_last_name    -> aes_decrypt(cusomer_ssn,'password') as customer_ssn    -> from customer; Query OK, 0 rows affected (0.03 sec)mysql> select * from v_customer;+-------------+---------------------+--------------------+--------------+| customer_id | customer_first_name | customer_last_name | customer_ssn |+-------------+---------------------+--------------------+--------------+|           1 | fred                | smith              | 456097234    |+-------------+---------------------+--------------------+--------------+
As shown in the preceding example, you can use the decryption function aes_decrypt () to obtain the value of the specified mermer_ssn and create a view to display the value, the original table is not broken through the encrypted storage of other customer_ssn values on the disk or database. In this way, the administrator ensures that sensitive information is not damaged at will. (Bkjia.com tutorial)

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.