MySQL vs. PostgreSQL
Unterschiede zu MySQL
Wer von MySQL kommt, vermisst in PostGreSQL Befehle wie 'show databases' oder 'show tables'. Diese Befehle sind kein
Standard-SQL. In PostGreSQL können sie folgendermaßen ersetzt werden:
- SHOW TABLES = \d
- SHOW DATABASES = \l
- SHOW COLUMNS = \d table
Die \*-Befehle funktionieren nur in psql. Über andere Interfaces kann man folgende Standard-SQL-Befehle benutzen:
- SHOW TABLES (\d) = SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'
- SHOW DATABASES (\l) = SELECT datname FROM pg_database;
- SHOW COLUMNS FROM table (\d table) = SELECT column_name FROM information_schema.columns WHERE table_name ='table';
Links