Home Database Mysql Tutorial mysql5.0.1提供视图功能其优势

mysql5.0.1提供视图功能其优势

Jun 07, 2016 pm 04:41 PM
Advantage Function supply view

视图相对于普通的表的优势有以下几点: 1、简单:使用视图的用户完全不需要关心后面对应的表结构、关联条件和筛选条件,对用户来说视图已经过滤好复合条件的结果集 2、安全:使用视图的用户只恩呢该访问他们被允许查询的结果集,对表的权限管理并不能限制多

视图相对于普通的表的优势有以下几点:

1、简单:使用视图的用户完全不需要关心后面对应的表结构、关联条件和筛选条件,对用户来说视图已经过滤好复合条件的结果集

2、安全:使用视图的用户只恩呢该访问他们被允许查询的结果集,对表的权限管理并不能限制多某个行某个列,但是通过视图可以简单的实现

3、数据独立:一旦视图的结构定义了,可以屏蔽表的结构变化对用户的影响,源表增加列对视图没有影响;源表修改列名,则只用通修改视图定义来适应变化,不会对访问者造成影响。

The view definition is “frozen” at creation time, so changes to the
underlying tables afterward do not affect the view definition. For
example, if a view is defined as SELECT * on a table, new columns added
to the table later do not become part of the view.

这点挺重要的,就是视图定义是会冻结的,比如我们使用select *来创建视图后,然后在通过alter table 添加字段后,这个后续添加的字段不会体现在原来视图上。

mysql> create view v_tchar as select * from tchar;

经过查询information_schema中的views发现,通过select *来定义的视图,会被转换成如下:
mysql> select * from views \G
*************************** 1. row ***************************
TABLE_CATALOG: NULL
TABLE_SCHEMA: liufofu
TABLE_NAME: v_tchar
VIEW_DEFINITION: select `liufofu`.`tchar`.`t1` AS `t1`,`liufofu`.`tchar`.`t2` AS `t2`,`liufofu`.`tchar`.`t3` AS `t3`,`liufofu`.`tchar`.`t4` AS `t4` from `liufofu`.`tchar`
CHECK_OPTION: NONE
IS_UPDATABLE: YES
DEFINER: root@localhost
SECURITY_TYPE: DEFINER
CHARACTER_SET_CLIENT: latin1
COLLATION_CONNECTION: latin1_swedish_ci
1 row in set (0.01 sec)

所以后续添加的字段不会体现在原定义的视图上。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The difference between vivox100s and x100: performance comparison and function analysis The difference between vivox100s and x100: performance comparison and function analysis Mar 23, 2024 pm 10:27 PM

Both vivox100s and x100 mobile phones are representative models in vivo's mobile phone product line. They respectively represent vivo's high-end technology level in different time periods. Therefore, the two mobile phones have certain differences in design, performance and functions. This article will conduct a detailed comparison between these two mobile phones in terms of performance comparison and function analysis to help consumers better choose the mobile phone that suits them. First, let’s look at the performance comparison between vivox100s and x100. vivox100s is equipped with the latest

What exactly is self-media? What are its main features and functions? What exactly is self-media? What are its main features and functions? Mar 21, 2024 pm 08:21 PM

With the rapid development of the Internet, the concept of self-media has become deeply rooted in people's hearts. So, what exactly is self-media? What are its main features and functions? Next, we will explore these issues one by one. 1. What exactly is self-media? We-media, as the name suggests, means you are the media. It refers to an information carrier through which individuals or teams can independently create, edit, publish and disseminate content through the Internet platform. Different from traditional media, such as newspapers, television, radio, etc., self-media is more interactive and personalized, allowing everyone to become a producer and disseminator of information. 2. What are the main features and functions of self-media? 1. Low threshold: The rise of self-media has lowered the threshold for entering the media industry. Cumbersome equipment and professional teams are no longer needed.

What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account? What are the functions of Xiaohongshu account management software? How to operate a Xiaohongshu account? Mar 21, 2024 pm 04:16 PM

As Xiaohongshu becomes popular among young people, more and more people are beginning to use this platform to share various aspects of their experiences and life insights. How to effectively manage multiple Xiaohongshu accounts has become a key issue. In this article, we will discuss some of the features of Xiaohongshu account management software and explore how to better manage your Xiaohongshu account. As social media grows, many people find themselves needing to manage multiple social accounts. This is also a challenge for Xiaohongshu users. Some Xiaohongshu account management software can help users manage multiple accounts more easily, including automatic content publishing, scheduled publishing, data analysis and other functions. Through these tools, users can manage their accounts more efficiently and increase their account exposure and attention. In addition, Xiaohongshu account management software has

Analysis of the characteristics and advantages of Go language Analysis of the characteristics and advantages of Go language Apr 03, 2024 pm 10:06 PM

Features of Go language: High concurrency (goroutine) Automatic garbage collection Cross-platform simplicity Modularity Advantages of Go language: High performance Security Scalability Community support

What are the views in Word? What are the views in Word? Mar 19, 2024 pm 06:10 PM

I guess that many students want to learn the typesetting skills of Word, but the editor secretly tells you that before learning the typesetting skills, you need to understand the word views clearly. In Word2007, 5 views are provided for users to choose. These 5 views include pages. View, reading layout view, web layout view, outline view and normal view, let’s learn about these 5 word views with the editor today. 1. Page view Page view can display the appearance of the print result of the Word2007 document, which mainly includes headers, footers, graphic objects, column settings, page margins and other elements. It is the page view closest to the print result. 2. Reading layout view Reading layout view displays Word2007 documents and Office in the column style of a book

What are the advantages and disadvantages of deploying PHP applications using serverless architecture? What are the advantages and disadvantages of deploying PHP applications using serverless architecture? May 06, 2024 pm 09:15 PM

Deploying PHP applications using Serverless architecture has the following advantages: maintenance-free, pay-as-you-go, highly scalable, simplified development and support for multiple services. Disadvantages include: cold start time, debugging difficulties, vendor lock-in, feature limitations, and cost optimization challenges.

Explore the advantages and application scenarios of Go language Explore the advantages and application scenarios of Go language Mar 27, 2024 pm 03:48 PM

The Go language is an open source programming language developed by Google and first released in 2007. It is designed to be a simple, easy-to-learn, efficient, and highly concurrency language, and is favored by more and more developers. This article will explore the advantages of Go language, introduce some application scenarios suitable for Go language, and give specific code examples. Advantages: Strong concurrency: Go language has built-in support for lightweight threads-goroutine, which can easily implement concurrent programming. Goroutin can be started by using the go keyword

What is PHP used for? Explore the role and functions of PHP What is PHP used for? Explore the role and functions of PHP Mar 24, 2024 am 11:39 AM

PHP is a server-side scripting language widely used in web development. Its main function is to generate dynamic web content. When combined with HTML, it can create rich and colorful web pages. PHP is powerful. It can perform various database operations, file operations, form processing and other tasks, providing powerful interactivity and functionality for websites. In the following articles, we will further explore the role and functions of PHP, with detailed code examples. First, let’s take a look at a common use of PHP: dynamic web page generation: P

See all articles