0
0
PostgreSQLquery~10 mins

SELECT with PostgreSQL-specific features - Interactive Code Practice

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 'ALL' instead of '*'
Writing 'columns' or 'everything' which are not valid SQL keywords
2fill in blank
medium

Complete the code to select the first 5 rows from the 'products' table using PostgreSQL syntax.

PostgreSQL
SELECT * FROM products [1] 5;
Drag options to blanks, or click blank then click option'
ATOP
BLIMIT
CFETCH
DROWS
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'TOP' which is not valid in PostgreSQL
Using 'FETCH' or 'ROWS' without the full syntax
3fill in blank
hard

Fix the error in the query to select distinct city names from the 'customers' table.

PostgreSQL
SELECT DISTINCT [1] FROM customers;
Drag options to blanks, or click blank then click option'
Acity_name
Bcities
Ccity
Dcustomer_city
Attempts:
3 left
💡 Hint
Common Mistakes
Using plural or incorrect column names
Using column names that do not exist in the table
4fill in blank
hard

Fill both blanks to select the name and the length of the name from the 'users' table using PostgreSQL functions.

PostgreSQL
SELECT name, [1](name) AS name_length FROM users WHERE [2](name) > 5;
Drag options to blanks, or click blank then click option'
ALENGTH
BLEN
CSIZE
DCOUNT
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'LEN' which is not valid in PostgreSQL
Using 'SIZE' or 'COUNT' which do not measure string length
5fill in blank
hard

Fill all three blanks to select the name in uppercase, the length of the name, and filter names longer than 3 characters from the 'members' table.

PostgreSQL
SELECT [1](name) AS upper_name, [2](name) AS name_len FROM members WHERE [3](name) > 3;
Drag options to blanks, or click blank then click option'
AUPPER
BLENGTH
DLOWER
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'LOWER' instead of 'UPPER' for uppercase conversion
Using 'LEN' instead of 'LENGTH' for string length