Re:Psql command line tutorial and cheat sheet
by Cieplak on Monday November 16, 2020 @03:38PM
(#25116702)
I went back and forth between psql and pgcli for several years, until I realized that pgcli tab-completes JOIN conditions.
[ Parent
| on HN ]
Re:Psql command line tutorial and cheat sheet
by jessedhillon on Tuesday November 17, 2020 @02:02AM
(#25120960)
Postgres supports JOIN USING. If your keys are named the same in both tables, say `user_id` then you can simply say
SELECT *
FROM parent
JOIN child USING (user_id)
I personally think naming your primary keys with their full name instead of calling all of them `id` or `key` is better practice also.