0
0
PostgreSQLquery~10 mins

Creating and switching schemas 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 schema named 'sales'.

PostgreSQL
CREATE [1] sales;
Drag options to blanks, or click blank then click option'
ADATABASE
BINDEX
CTABLE
DSCHEMA
Attempts:
3 left
💡 Hint
Common Mistakes
Using CREATE DATABASE instead of CREATE SCHEMA.
Trying to create a table with CREATE TABLE instead of a schema.
2fill in blank
medium

Complete the code to switch to the schema named 'marketing'.

PostgreSQL
SET search_path TO [1];
Drag options to blanks, or click blank then click option'
Asales
Badmin
Cmarketing
Dpublic
Attempts:
3 left
💡 Hint
Common Mistakes
Using SET schema TO instead of SET search_path TO.
Using a schema name that does not exist.
3fill in blank
hard

Fix the error in the code to create a schema named 'finance'.

PostgreSQL
CREATE [1] finance;
Drag options to blanks, or click blank then click option'
ASCHEMA;
BSCHEMA
CDATABASE;
DTABLE;
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the semicolon at the end.
Using CREATE DATABASE instead of CREATE SCHEMA.
4fill in blank
hard

Fill both blanks to set the search path to 'hr' schema and then create a table named 'employees'.

PostgreSQL
SET [1] TO hr;
CREATE [2] employees (id INT);
Drag options to blanks, or click blank then click option'
Asearch_path
BSCHEMA
CTABLE
DDATABASE
Attempts:
3 left
💡 Hint
Common Mistakes
Using SET schema TO instead of SET search_path TO.
Using CREATE SCHEMA instead of CREATE TABLE for the second blank.
5fill in blank
hard

Fill all three blanks to create a schema 'analytics', switch to it, and create a table 'reports' with a column 'report_id' as integer.

PostgreSQL
CREATE [1] analytics;
SET [2] TO analytics;
CREATE [3] reports (report_id INT);
Drag options to blanks, or click blank then click option'
ASCHEMA
Bsearch_path
CTABLE
DDATABASE
Attempts:
3 left
💡 Hint
Common Mistakes
Using CREATE DATABASE instead of CREATE SCHEMA.
Forgetting to set the search_path before creating the table.
Using CREATE SCHEMA instead of CREATE TABLE for the last blank.