Create view for column information : Matadata « Command MySQL « SQL / MySQL






Create view for column information

    
mysql>
mysql> CREATE OR REPLACE VIEW COLUMNS_IN_INDEX
    ->         (INDEX_CREATOR, INDEX_NAME,
    ->          TABLE_CREATOR, TABLE_NAME, COLUMN_NAME,
    ->          COLUMN_SEQ, ORDERING) AS
    -> SELECT   UPPER(INDEX_SCHEMA), UPPER(INDEX_NAME),
    ->          UPPER(TABLE_SCHEMA), UPPER(TABLE_NAME),
    ->          UPPER(COLUMN_NAME), SEQ_IN_INDEX,
    ->          CASE
    ->             WHEN COLLATION = 'A' THEN 'ASCENDING'
    ->             WHEN COLLATION = 'D' THEN 'DESCENDING'
    ->             ELSE 'OTHER'
    ->          END
    -> FROM     INFORMATION_SCHEMA.STATISTICS;
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql>

   
    
    
    
  








Related examples in the same category

1.Create view for base table and temporary table
2.Create view for columns
3.Create view for view information from INFORMATION_SCHEMA.VIEWS
4.Create view for user authentication
5.Create view for database authentication
6.Create view on table Privileges
7.Create view for Column Privileges