Setting up SMS Database using Postgres

In this blog post, we will walk through the steps to set up an SMS database using Postgres. This will help us learn SQL as part of our course using a database management system.

Connect to pg.itversity.com

First, we need to connect to the database running on pg.itversity.com container using Docker Compose command. Make sure to run this command from your host machine (Mac, Windows, AWS Cloud9, or Linux).

docker-compose exec pg.itversity.com psql -U postgres

Run SQL Commands

Once you are connected to the Postgres CLI, you can run the required SQL commands to create the database, create a user, and grant permissions on the database to the user.

CREATE DATABASE itversity_sms_db;

CREATE USER itversity_sms_user WITH ENCRYPTED PASSWORD 'itversity';

GRANT ALL ON DATABASE itversity_sms_db TO itversity_sms_user;

\q

By following these steps, you will successfully set up an SMS database using Postgres. You can now use these details to connect to the database using a Jupyter-based environment and start learning SQL.

Conclusion

Setting up a database is an essential step in learning SQL, and Postgres offers a powerful platform to practice SQL queries. By following the steps outlined in this blog post, you are now ready to enhance your SQL skills using the SMS database. Dive into the world of SQL queries and database management with confidence!

Looking for more hands-on practice? Check out our labs where you can apply your SQL knowledge in real-world scenarios. Sign up for our labs today and sharpen your SQL skills!