Alternando entre banco de dados corrente:
MySQL/SQL Server:
USE database_name;
PostgreSQL (psql):
\c database_name;
Exibindo as tabelas do banco de dados:
MySQL:
SHOW TABLES;
SQL Server:
SELECT * FROM sys.tables;
PostgreSQL (psql):
\d;
PostgreSQL:
SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';
Listagem dos banco de dados:
MySQL:
SHOW DATABASES;
PostgreSQL(psql):
\l;
PostgreSQL:
SELECT datname FROM pg_database;
Exibindo as colunas de uma tabela:
MySQL:
SHOW COLUMNS;
PostgreSQL(psql):
\d table_name;
PostgreSQL:
SELECT column_name FROM information_schema.columns WHERE table_name ='table_name';
MySQL:
DESCRIBE TABLE;
PostgreSQL (psql):
d+ table_name;
PostgreSQL:
SELECT column_name FROM information_schema.columns WHERE table_name ='table_name';
SQL Server;
exec sp_help 'table_name';
Até a próxima.