Difference between revisions of "What are my tables?"
From SQLZOO
(Created page with "Get a list of all tables <div class='ht'> <div> We should expect to find a system table that includes a list of tables. We should expect this to contain a great deal of extra ...") |
|||
| Line 5: | Line 5: | ||
We should expect this to contain a great deal of extra data that is hard to understand. | We should expect this to contain a great deal of extra data that is hard to understand. | ||
</div> | </div> | ||
| − | <source lang=sql class='tidy'> | + | <source lang=sql class='tidy'> |
| − | + | ||
| − | + | ||
</source> | </source> | ||
<source lang='sql' class='def e-sqlite'>SELECT * FROM sqlite_master | <source lang='sql' class='def e-sqlite'>SELECT * FROM sqlite_master | ||
Revision as of 12:58, 11 July 2012
Get a list of all tables
We should expect to find a system table that includes a list of tables. We should expect this to contain a great deal of extra data that is hard to understand.
SELECT * FROM sqlite_master WHERE TYPE='table'
SELECT * FROM syscat.TABLES WHERE tabschema = 'SCOTT'
SELECT Name FROM MSysObjects WHERE TYPE=1 AND Flags=0
SELECT tablename FROM pg_tables WHERE tableowner = CURRENT_USER
SELECT * FROM cat
SELECT * FROM sysobjects WHERE xtype='U'
SHOW TABLES
SELECT * FROM information_schema.TABLES WHERE table_type='BASE TABLE'
SELECT * FROM sysobjects WHERE TYPE='U'