File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ ===============================================================================
3+ Database Exploration
4+ ===============================================================================
5+ Purpose:
6+ - To explore the structure of the database, including the list of tables and their schemas.
7+ - To inspect the columns and metadata for specific tables.
8+
9+ Table Used:
10+ - INFORMATION_SCHEMA.TABLES
11+ - INFORMATION_SCHEMA.COLUMNS
12+ ===============================================================================
13+ */
14+
15+ -- Retrieve a list of all tables in the database
16+ SELECT
17+ TABLE_CATALOG,
18+ TABLE_SCHEMA,
19+ TABLE_NAME,
20+ TABLE_TYPE
21+ FROM INFORMATION_SCHEMA .TABLES ;
22+
23+ -- Retrieve all columns for a specific table (dim_customers)
24+ SELECT
25+ COLUMN_NAME,
26+ DATA_TYPE,
27+ IS_NULLABLE,
28+ CHARACTER_MAXIMUM_LENGTH
29+ FROM INFORMATION_SCHEMA .COLUMNS
30+ WHERE TABLE_NAME = ' dim_customers' ;
You can’t perform that action at this time.
0 commit comments