[CODEBASE] How to INSTALL PostgreSQL for learning and practicing SQL (Youtube video)

FULL VIDEO:

STEP #1: DIGITALOCEAN

Go to this link: https://m.do.co/c/1e56c4c455b5 ($100 coupon for 60 days for Digital Ocean)

No-affiliate link (without coupon): https://www.digitalocean.com/

STEP #2: COMMAND LINE (with root user)

adduser tomi
usermod -aG sudo tomi
exit

STEP #3: COMMAND LINE (with new user)

sudo apt-get update
sudo apt-get install mc
sudo apt-get install postgresql postgresql-contrib
sudo -i -u postgres
psql

STEP #4: SQL (with postgres user)

CREATE USER tomi WITH PASSWORD 'my_secret_pw';
\q
exit

STEP #5: SQL (with new user)

psql -U tomi -d postgres
CREATE TABLE test(column1 TEXT, column2 INT);
INSERT INTO test VALUES ('Hello', 111);
INSERT INTO test VALUES ('World', 222);
SELECT * FROM test;
\q

STEP #6: SQL Workbench configurations

echo "listen_addresses = '*'" >> /etc/postgresql/*/main/postgresql.conf
echo 'host all all 0.0.0.0/0 md5' >> /etc/postgresql/*/main/pg_hba.conf
sudo /etc/init.d/postgresql restart
exit

STEP #7: SQL Workbench installation

URL: jdbc:postgresql://138.197.180.215:5432/postgres

STEP #8: Test

SELECT * FROM test;
CREATE TABLE test_results
(
  name TEXT,
  student_id INTEGER PRIMARY KEY,
  birth_date DATE,
  test_result DECIMAL NOT NULL,
  grade TEXT NOT NULL,
  passed BOOLEAN NOT NULL
);
INSERT INTO test_results
VALUES
('Jesse', 2, '1988-02-11', 74.00, 'C', TRUE),
('Todd', 3, '1987-06-13', 60.00, 'D', TRUE),
('Tuco', 4, '1970-11-11', 15.50, 'F', FALSE),
('Gus', 5, '1975-08-08', 80.00, 'B', TRUE)
;
SELECT * FROM test_results;

LINKS MENTIONED IN THE EPISODE


Cheers,
Tomi Mester

Cheers,
Tomi Mester