Introduction
In this challenge, you'll embark on a culinary journey by creating your own recipe database using PostgreSQL. As a budding food blogger, you'll set up a dedicated database named recipe_db to manage your growing collection of recipes.
The challenge involves using the createdb command to create the database and the psql -l command to verify its creation by listing all databases. All commands should be executed in the default user directory ~/project. Successfully completing the challenge will result in recipe_db appearing in the output of psql -l.
Create Your Own Recipe Database
Embark on your culinary journey! As a budding food blogger, you need a well-organized system to manage your growing collection of recipes. This challenge guides you through setting up a dedicated PostgreSQL database to store and manage your delicious creations.
Tasks
- Create a PostgreSQL database named
recipe_db. - Verify the database creation by listing all databases.
Requirements
- Use the
createdbcommand to create the database. - Use the
psql -lcommand to list all databases and confirm the creation ofrecipe_db. - All commands should be executed in the default user directory
~/project.
Examples
After successfully creating the database and listing all databases, you should see recipe_db in the output of psql -l.
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+---------+---------+-----------------------
postgres | postgres | UTF8 | C.UTF-8 | C.UTF-8 |
recipe_db | labex | UTF8 | C.UTF-8 | C.UTF-8 |
template0 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | C.UTF-8 | C.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)

Hints
- Remember to use the
createdbcommand followed by the database name. - The
psql -lcommand lists all available databases.
Summary
In this challenge, the task was to create a PostgreSQL database named recipe_db using the createdb command and then verify its creation by listing all databases with the psql -l command. The challenge emphasized the use of command-line tools for database management within a PostgreSQL environment.
The key learning points include understanding how to create a new database using createdb and how to list existing databases using psql -l. Successfully completing the challenge demonstrates proficiency in basic PostgreSQL database administration tasks.


