0
0
PostgreSQLquery~10 mins

Why PostgreSQL has rich data types - 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'.

PostgreSQL
SELECT [1] FROM employees;
Drag options to blanks, or click blank then click option'
A*
Ball
Ccolumns
Deverything
Attempts:
3 left
💡 Hint
Common Mistakes
Using words like 'all' or 'columns' instead of the symbol *.
Forgetting to specify what to select.
2fill in blank
medium

Complete the code to create a table named 'products' with a column 'price' that stores decimal numbers.

PostgreSQL
CREATE TABLE products (price [1]);
Drag options to blanks, or click blank then click option'
ABOOLEAN
BVARCHAR
CDECIMAL
DTEXT
Attempts:
3 left
💡 Hint
Common Mistakes
Using VARCHAR or TEXT which store text, not numbers.
Using BOOLEAN which stores true/false values.
3fill in blank
hard

Fix the error in the code to create a table with a column 'created_at' that stores date and time.

PostgreSQL
CREATE TABLE orders (created_at [1]);
Drag options to blanks, or click blank then click option'
ATIME
BDATE
CDATETIME
DTIMESTAMP
Attempts:
3 left
💡 Hint
Common Mistakes
Using DATE which stores only the date without time.
Using TIME which stores only the time without date.
Using DATETIME which is not a PostgreSQL data type.
4fill in blank
hard

Fill both blanks to create a table 'locations' with a column 'coordinates' that stores geometric points.

PostgreSQL
CREATE TABLE locations (coordinates [1]); -- Use [2] for geometric data type
Drag options to blanks, or click blank then click option'
APOINT
BVARCHAR
CINTEGER
DBOOLEAN
Attempts:
3 left
💡 Hint
Common Mistakes
Using VARCHAR or INTEGER which are not geometric types.
Using BOOLEAN which stores true/false values.
5fill in blank
hard

Fill all three blanks to create a table 'users' with a JSON column 'profile', a UUID column 'user_id', and a boolean column 'active'.

PostgreSQL
CREATE TABLE users (user_id [1], profile [2], active [3]);
Drag options to blanks, or click blank then click option'
AJSON
BUUID
CBOOLEAN
DTEXT
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up data types like using TEXT instead of JSON.
Using VARCHAR for UUID or BOOLEAN columns.