Search

My notebook

Month

September 2014

PostgreSQL – List All Tables and Describe Tables

Connect to the database:
psql [-U username] [-h hostname] database-name

To list all databases, type either one of the following:
\l
\list

To list tables in a current database, type:
\dt

To describe a table, type:
\d <table-name>

 

From http://onewebsql.com/

Advertisements

DB2 – List All Tables and Describe Tables

Connect to the database:
db2 connect to <database-name>

List all tables:
db2 list tables for all

To list all tables in selected schema, use:
db2 list tables for schema <schema-name>

To describe a table, type:
db2 describe table <table-schema.table-name>

 

From http://onewebsql.com/

MySQL – List All Tables and Describe Tables

Connect to the database:

mysql [-u username] [-h hostname] database-name

To list all databases, in the MySQL prompt type:
show databases

Then choose the right database:
use <database-name>

List all tables in the database:
show tables

Describe a table:
desc <table-name>

From http://onewebsql.com/

Show tables in Oracle

Connect to the database:
sqlplus username/password@database-name

To list all tables owned by the current user, type:
select tablespace_name, table_name from user_tables;

To list all tables in a database:
select tablespace_name, table_name from dba_tables;

To list all tables accessible to the current user, type:
select tablespace_name, table_name from all_tables;

 

From http://onewebsql.com/

 

OR

 

  • SELECT owner, table_name FROM dba_tables;
  • SELECT owner, table_name FROM all_tables;
  • SELECT table_name FROM user_tables;
  • SELECT view_name FROM all_views;

Blog at WordPress.com.

Up ↑