PostgreSQL Vs MySQL differences in syntax - side by side comparison cheatsheet for show databases, tables, schemas and more
PostgreSQL Vs MySQL Syntax Comparison - Cheatsheet for databases, tables, schemas
In the previous post for PostgreSQL Vs MySQL Syntax Comparison - Useful basic commands with examples , we compared the detailed differences between PostgreSQL vs MySQL syntax. If you haven’t read it already we strongly recommend to read that post before going through this cheatsheet as it has more detailed examples with basic command usage for postgres and mysql.
As a handy reference, here is the cheatsheet for PostgreSQL vs MySQL syntax comparison highlighting the differences.
How to | PostgreSQL | MySQL |
---|---|---|
Show list of databases | \l | show databases |
Use database | \c {db_name} | use {db_name} |
Show list of schemas | \dn | show schemas |
Show list of tables | \d or \d+ or \dt or \dt+ | show tables |
Describe table | \dt {table_name} or \d+ {table_name} | describe {table_name} |
Show create table | pg_dump -st {table_name} {dbname} | show create table {table_name} |
Show list of users or roles | \du | SELECT User, Host from mysql.user; |
Show process list | select * from pg_stat_activity | show processlist |
Comment single line | -- (double dash) | # (hash) |
String quotes | Only supports single quote (') eg:`where name = 'TipSeason'` | Supports both single(') and double quotes (") eg: `where name = "TipSeason"` |
Case sensitivity | Postgres is case sensitive eg: `WHERE name = 'TipSeason'` gives different results than `WHERE name = 'tipseason'` | MySQL is case insensitive. |
PostgreSQL Vs MySQL Syntax Comparison - Useful basic commands with examples
We hope you like this post. If you have any questions or suggestions or need any other additional info, please comment below.
We have started a coding community for most frequently used real world coding tips. You can join us here
TipSeason Discord channel
TipSeason Facebook Group
What do you want to learn next ? Drop a comment below!1600+ Midjourney prompts + 1500 AI Art prompt keywords, 25 categories, logo, tshirt, coloring page, characters , AI art prompts, Digital art https://t.co/X4zMgNepnk via @Etsy
— TipSeason⚡💡 (@thetipseason) April 11, 2023