## Notes 

## 26.3.48 The INFORMATION_SCHEMA VIEWS Table 

• USER_PRIVILEGES  is a nonstandard INFORMATION_SCHEMA  table. 

The following statements are not  equivalent: 

SELECT ... FROM INFORMATION_SCHEMA.USER_PRIVILEGES SHOW GRANTS ... 

The VIEWS  table provides information about views in databases. You must have the SHOW VIEW  privilege to access this table. 

The VIEWS  table has these columns: 

## • TABLE_CATALOG 

The name of the catalog to which the view belongs. This value is always def . 

## • TABLE_SCHEMA 

The name of the schema (database) to which the view belongs. 

## • TABLE_NAME 

The name of the view. 

## • VIEW_DEFINITION 

The SELECT  statement that provides the definition of the view. This column has most of what you see in the Create Table  column that SHOW CREATE VIEW  produces. Skip the words before SELECT  and skip the words WITH CHECK OPTION . Suppose that the original statement was: 

CREATE VIEW v AS SELECT s2,s1 FROM t WHERE s1 > 5 ORDER BY s1 WITH CHECK OPTION; 

Then the view definition looks like this: 

SELECT s2,s1 FROM t WHERE s1 > 5 ORDER BY s1 

## • CHECK_OPTION 

The value of the CHECK_OPTION  attribute. The value is one of NONE , CASCADE , or LOCAL . 

## • IS_UPDATABLE 

MySQL sets a flag, called the view updatability flag, at CREATE VIEW  time. The flag is set to YES  (true) if UPDATE  and DELETE  (and similar operations) are legal for the view. Otherwise, the flag is set to NO (false). The IS_UPDATABLE  column in the VIEWS  table displays the status of this flag. It means that the server always knows whether a view is updatable. 

If a view is not updatable, statements such UPDATE , DELETE , and INSERT  are illegal and are rejected. (Even if a view is updatable, it might not be possible to insert into it; for details, refer to Section 25.5.3, “Updatable and Insertable Views” .) 

