Skip to Content
0 likes
Connect With psql and List Your Tables Level: Beginner

Connect to a database with psql and use the backslash commands to list tables and columns. After this, you can see what is inside any database you can reach.

0 likes
Count Rows Per Group With GROUP BY Level: Beginner

Count rows per category with GROUP BY, sort the biggest group first and keep only large groups with HAVING. After this, one query answers a how-many-for-each question.

0 likes
Find Duplicate Rows Level: Beginner

Find repeated values with GROUP BY and HAVING, list the full rows and catch duplicates that differ by capital letters. After this, you know what is duplicated before you delete anything.

0 likes
Fix "column does not exist" Level: Beginner

Find the cause of the column does not exist error from the five usual ones: a typo, double quotes, an alias in WHERE, a quoted name and a missing table. After this, you can fix it in a minute instead of changing the table.

0 likes
Import a CSV With \copy Level: Beginner

Load a CSV file into a table with the psql command copy, and read the two errors you will meet first. After this, you can import a file without writing INSERT statements.

0 likes
Verify a PostgreSQL Practice Database and Its Persistence Level: Beginner

Identify an isolated practice database, record its cluster and marker, and verify persistence through restart and container replacement before exact cleanup.

0 likes
Keep Rows With No Match Using LEFT JOIN Level: Beginner

Keep customers who have no orders with LEFT JOIN, find them with IS NULL and avoid the WHERE that turns the join back into an inner join. After this, a missing match no longer removes a row from your result.

0 likes
Select Only the Columns You Need Level: Beginner

Replace SELECT * with the columns you need and see what a new column does to a query that uses the star. After this, your saved queries stop changing when the table does.

0 likes
Run UPDATE and DELETE in a Transaction First Level: Beginner

Run an UPDATE or DELETE inside a transaction, check the row count and roll back if it is wrong. After this, a missing WHERE no longer costs you the data.

0 likes
Why = NULL Returns Nothing Level: Beginner

See why a comparison with NULL returns no rows and fix it with IS NULL, IS DISTINCT FROM or COALESCE. After this, your WHERE clauses stop dropping rows with missing values.