0
0
GraphQLquery~10 mins

Validation errors in GraphQL - 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 'users'.

GraphQL
SELECT [1] FROM users;
Drag options to blanks, or click blank then click option'
Aeverything
Ball
Ccolumns
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using words like 'all' or 'columns' instead of '*'
Leaving the blank empty
2fill in blank
medium

Complete the code to filter rows where the age is greater than 30.

GraphQL
SELECT * FROM employees WHERE age [1] 30;
Drag options to blanks, or click blank then click option'
A<
B=
C>
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' which checks for equality
Using '<' which checks for less than
3fill in blank
hard

Fix the error in the SQL query to count the number of orders.

GraphQL
SELECT COUNT([1]) FROM orders;
Drag options to blanks, or click blank then click option'
Acount
B*
Corders
Dorder_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using a column name that might have NULL values
Using the table name inside COUNT
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps words to their lengths only if length is greater than 3.

GraphQL
{word: [1] for word in words if [2](word) > 3}
Drag options to blanks, or click blank then click option'
Alen(word)
Bword
Clen
Dword.length
Attempts:
3 left
💡 Hint
Common Mistakes
Using word.length which is not valid in Python
Using word instead of its length in the dictionary value
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps uppercase keys to values only if value is greater than 0.

GraphQL
result = {{ [1]: [2] for k, v in data.items() if v [3] 0 }}
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
C>
Dk
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'k' instead of 'k.upper()' for keys
Using '<' instead of '>' in the condition