laika222
4/25/2017 - 2:32 AM

Shows how to view description of database tables, views, and how to view description of columns and data types within a table.

Shows how to view description of database tables, views, and how to view description of columns and data types within a table.

-- Shows tables in database
SELECT * FROM INFORMATION_SCHEMA.TABLES
	WHERE TABLE_TYPE='BASE TABLE';

-- Shows tables and views in database
SELECT * FROM INFORMATION_SCHEMA.TABLES;

-- Shows columns and data types for a certain table
SELECT * FROM INFORMATION_SCHEMA.COLUMNS 
  WHERE TABLE_NAME = 'orders';
-- Shows tables in database
SHOW TABLES;

-- Shows tables and views in database
SHOW FULL TABLES;

-- Shows columns and data types for a certain table
DESCRIBE orders;

-- Shows columns and data types for a certain table, as well as constraints like foreign keys and what they reference
SHOW CREATE TABLE orders;