Keine Cache-Version

Caching deaktiviert Standardeinstellung für diese Seite:aktiviert (code DEF204)
Wenn die Anzeige zu langsam ist, können Sie den Benutzermodus deaktivieren, um die zwischengespeicherte Version anzuzeigen.

Rechercher dans le manuel MySQL

25.36 The INFORMATION_SCHEMA VIEWS Table

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:

    1.   SELECT s2,s1 FROM t
    2.   WHERE s1 > 5
    3.   ORDER BY s1

    Then the view definition looks like this:

    1. 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 24.5.3, “Updatable and Insertable Views”.)

  • DEFINER

    The account of the user who created the view, in 'user_name'@'host_name' format.

  • SECURITY_TYPE

    The view SQL SECURITY characteristic. The value is one of DEFINER or INVOKER.

  • CHARACTER_SET_CLIENT

    The session value of the character_set_client system variable when the view was created.

  • COLLATION_CONNECTION

    The session value of the collation_connection system variable when the view was created.

Notes

MySQL permits different sql_mode settings to tell the server the type of SQL syntax to support. For example, you might use the ANSI SQL mode to ensure MySQL correctly interprets the standard SQL concatenation operator, the double bar (||), in your queries. If you then create a view that concatenates items, you might worry that changing the sql_mode setting to a value different from ANSI could cause the view to become invalid. But this is not the case. No matter how you write out a view definition, MySQL always stores it the same way, in a canonical form. Here is an example that shows how the server changes a double bar concatenation operator to a CONCAT() function:

  1. mysql> SET sql_mode = 'ANSI';
  2. Query OK, 0 rows affected (0.00 sec)
  3.  
  4. mysql> CREATE VIEW test.v AS SELECT 'a' || 'b' as col1;
  5. Query OK, 0 rows affected (0.00 sec)
  6.  
  7. mysql> SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS
  8.        WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'v';
  9. +----------------------------------+
  10. | VIEW_DEFINITION                  |
  11. +----------------------------------+
  12. | select concat('a','b') AS `col1` |
  13. +----------------------------------+
  14. 1 row in set (0.00 sec)

The advantage of storing a view definition in canonical form is that changes made later to the value of sql_mode do not affect the results from the view. However, an additional consequence is that comments prior to SELECT are stripped from the definition by the server.


Suchen Sie im MySQL-Handbuch

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 26/06/2006, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/mysql-rf-views-table.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:en Manuel MySQL : https://dev.mysql.com/

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.

Inhaltsverzeichnis Haut