### install version 15 of postgresql to mac brew install postgresql@15
### connect to the default db postgres psql -U your_user_name the_db_you_want_to_connect_to
### Common mistake here is to start with psql -U postgres
### If the user postgres (default) is not defined you get an error connecting to socket
### Instead of using this default command, specify the user and the db
### list existing databases \l
### start postgresql server brew services start postgresql@15
### create a database called testdb CREATE DATABASE testdb;
### Do not forget the semicolon
### connect to a database 'testdb' from within the psql prompt \c testdb
### create a table with a primary key and other column(s) CREATE TABLE table_name (
id integer PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
col_name varchar(100) NOT NULL CHECK (col_name <> '')
);