Install with Homebrew:
$ brew install postgresql
Start postgresql as a service
$ brew services start postgresql
Enter Queries using psql:
$ psql postgres
$ CREATE DATABASE database_name
$ ALTER DATABASE database_name
(press enter, and do not end with a semi-colon. This will make it possible to enter multiple lines).
$ ADD COLUMN id integer;
Set id as primary key:
$ ALTER TABLE table_name
$ ADD PRIMARY KEY (column_name);
Leave a Reply
You must be logged in to post a comment.