INFORMATION_SCHEMA provides a way to access database meta data.
Metadata is data about data, such as database name or table name, column data type, or access rights, and so on. Some other terms used to express this information include the data dictionary and the system catalog.
For example:
SELECT table_name, TABLE_TYPE, engine
From Information_schema.tables
WHERE table_schema = ' DB5 '
ORDER BY table_name DESC;
TABLE_NAME (table name) |
Table_type (table type) |
Engine |
V56 |
View (views) |
Null |
V3 |
View (views) |
Null |
V2 |
View (views) |
Null |
V |
View (views) |
Null |
|
|
base table (Basic tables) |
|
T7 |
base table (Basic tables) |
|
T3 |
base table (Basic tables) |
|
T2 |
base table (Basic tables) |
|
T |
base table (Basic tables) |
|
Pk |
base table (Basic tables) |
|
|
|
base table (Basic tables) |
|
|
|
base table (Basic tables) |
|
K |
base table (Basic tables) |
|
|
|
base table (Basic tables) |
|
|
|
base table (Basic tables) |
|
Fk2 |
base table (Basic tables) |
|
Fk |
base table (Basic tables) |
|
The collection contains 17 rows (0.01 seconds).
Explanation: The statement requests that all tables in the database DB5 be listed in reverse alphabetical order, but only three types of information are displayed: Table name, table type, and table engine.
INFORMATION_SCHEMA is an information database that holds information about all the other databases maintained by the MySQL server. In Information_schema, there are several read-only tables. They are actually views, not basic tables, so you will not be able to see any files associated with them.
Each MySQL user has access to these tables, but only to specific rows in the table that contain objects with the appropriate access rights for the user.
The advantages of select
SELECT ... The purpose of the FROM INFORMATION_SCHEMA statement is to provide a more consistent way to access the information provided by the various show statements (show DATABASES, show tables, and so on) that MySQL supports. There are a number of advantages to using Select when compared to show
· Conform to Codd rules. In other words, all accesses are made on the table.
· You do not need to know the syntax of the new statement. Because they already know how the select works, you only need to know the object name.
· Realize people need not worry about adding keyword matters.
· There are millions of possible changes in output, not one. This provides greater flexibility for applications that have different requirements for metadata.
· Porting is easier because other DBMS uses this type of approach.
However, because show is popular among MySQL employees and users, if the show disappears, it can lead to confusion, so the traditional syntax does not give you enough reason to eliminate it. In fact, there are a number of enhancements to show in MySQL 5.1. For an introduction to this, see section 23.2, "extension of the show statement."
Standard
In MySQL, the implementation of the INFORMATION_SCHEMA table structure complies with the "Ansi/iso sql:2003 Standard, part 11th outline". Our aim is to obtain an approximate compatibility with the sql:2003 core features F021 "basic information scheme".
Users of SQL Server 2000 (who also follow this standard) may have noticed their high similarity. However, MySQL omits many columns that are not relevant to our implementation and adds some MySQL-specific columns. One of the columns is INFORMATION_SCHEMA. The engine column in the Tables table.
Although other DBMS use different names, such as syscat or systems, the standard name is INFORMATION_SCHEMA.
In fact, although we do not need to generate a file named Information_schema, we still provide a new database named INFORMATION_SCHEMA. You can select Information_schema as the default database using the USE statement, but the only way to access the tables contained in the database is by using a SELECT statement. You cannot insert content in it, you cannot update them, and you cannot delete the contents.
Permissions
There is no difference between current permission (show) requirements and SELCET permission requirements. In either case, to see information about it, you need to have specific permissions on a class of objects.
Dev.mysql.com/doc/refman/5.1/zh/information-schema.html
The only way to access the tables included in the database information_schema is to use the SELECT statement. You cannot insert content in it, you cannot update them, and you cannot delete the contents.
It reflects information about the MySQL database's data.
you have to modify the description of the table and the field is not directly in the INFORMATION_SCHEMA, but you need to modify the corresponding tables in the database, after the corresponding table, the INFORMATION_SCHEMA data will automatically update.