Skip to content
Nate
Stephens

ALL POSTSDatabases

All of my published content

PostgreSQL Foreign Keys

If you're going to have two tables reference each other, use foreign keys where possible. It forces useful constraints to make sure delete and update behaviors are intentional and it makes the queries faster.

PostgreSQL DB Connection and Security

A guide to connecting to a PostgreSQL database using the pg package in Node.js, explaining the differences between a client and a pool of clients. Also emphasizes the importance of parameterizing queries and sanitizing user inputs to prevent SQL injection attacks.

PostgreSQL CRUD Commands

A brief overview of common SQL commands used for interaction with PostgreSQL. It explains how to insert single and multiple records, perform upsert operations, update and delete records, and select specific columns.

PostgreSQL Functions and Operators

PostgreSQL provides a large number of functions and operators for the built-in data types. Here I briefly go over LIKE and ILIKE, two symbols used for character matching, and the CONCAT function. These all allow for basic fuzzy searching of your data.

PostgreSQL Databases and Tables

Here is a quick guide on how to run PostgreSQL in Docker. It further explains how to create a database, tables, and records, as well as how to drop and alter tables. It also provides examples of psql commands and explains how to use them.