0
0
PostgreSQLquery~10 mins

Creating databases and connecting in PostgreSQL - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a new database named 'school'.

PostgreSQL
CREATE DATABASE [1];
Drag options to blanks, or click blank then click option'
Atestdb
Bstudents
Cmydb
Dschool
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different database name than 'school'.
Forgetting the semicolon at the end.
2fill in blank
medium

Complete the command to connect to the database named 'school'.

PostgreSQL
\c [1]
Drag options to blanks, or click blank then click option'
Astudents
Bmydb
Cschool
Dtestdb
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to connect to a database that does not exist.
Missing the backslash before 'c'.
3fill in blank
hard

Fix the error in the command to create a database named 'school'.

PostgreSQL
CREATE [1] school;
Drag options to blanks, or click blank then click option'
ADATABASE
BINDEX
CSCHEMA
DTABLE
Attempts:
3 left
💡 Hint
Common Mistakes
Using TABLE or SCHEMA instead of DATABASE.
Misspelling the keyword DATABASE.
4fill in blank
hard

Fill both blanks to connect to the database 'school' as user 'admin'.

PostgreSQL
psql -U [1] -d [2]
Drag options to blanks, or click blank then click option'
Aadmin
Bschool
Cuser
Dtestdb
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping user and database names.
Using wrong flags for user or database.
5fill in blank
hard

Fill both blanks to create a database named 'school', connect to it, and then list all tables.

PostgreSQL
CREATE [1] school;
\c [2]
\dt
Drag options to blanks, or click blank then click option'
ADATABASE
Bschool
CTABLE
DDATABASES
Attempts:
3 left
💡 Hint
Common Mistakes
Using TABLE instead of DATABASE to create the database.
Trying to list tables before connecting.