0
0
PostgreSQLquery~10 mins

Why schemas matter in PostgreSQL - Test Your Understanding

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

Complete the code to select all columns from the table named 'employees' in the schema 'hr'.

PostgreSQL
SELECT * FROM hr.[1];
Drag options to blanks, or click blank then click option'
Apositions
Bdepartments
Csalaries
Demployees
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to specify the schema name before the table.
Using the wrong table name.
2fill in blank
medium

Complete the code to create a new schema named 'sales'.

PostgreSQL
CREATE SCHEMA [1];
Drag options to blanks, or click blank then click option'
Amarketing
Bsales
Chr
Dfinance
Attempts:
3 left
💡 Hint
Common Mistakes
Using a table name instead of a schema name.
Misspelling the schema name.
3fill in blank
hard

Fix the error in the code to insert a row into the 'orders' table inside the 'sales' schema.

PostgreSQL
INSERT INTO [1].orders (order_id, amount) VALUES (1, 100);
Drag options to blanks, or click blank then click option'
Asales
Bpublic
Chr
Dfinance
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong schema name.
Omitting the schema name.
4fill in blank
hard

Fill both blanks to grant SELECT permission on the 'customers' table in the 'crm' schema to user 'alice'.

PostgreSQL
GRANT [1] ON [2].customers TO alice;
Drag options to blanks, or click blank then click option'
ASELECT
BINSERT
Ccrm
Dsales
Attempts:
3 left
💡 Hint
Common Mistakes
Granting the wrong permission like INSERT.
Using the wrong schema name.
5fill in blank
hard

Fill all three blanks to create a table named 'products' in the 'inventory' schema with columns 'id' (integer) and 'name' (text).

PostgreSQL
CREATE TABLE [1].[2] ([3]);
Drag options to blanks, or click blank then click option'
Ainventory
Bproducts
Cid INTEGER, name TEXT
Dsales
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong schema or table name.
Incorrect column definitions.