0
0
SQLquery~10 mins

Why built-in functions matter in SQL - 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 the current date using a built-in SQL function.

SQL
SELECT [1];
Drag options to blanks, or click blank then click option'
ACURRENT_DATE
BNOW
CGETDATE
DTODAY
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOW() returns date and time, not just the date.
GETDATE() is specific to some SQL dialects like SQL Server.
TODAY() is not a standard SQL function.
2fill in blank
medium

Complete the code to count the number of rows in the 'employees' table using a built-in function.

SQL
SELECT [1](*) FROM employees;
Drag options to blanks, or click blank then click option'
ASUM
BNUMBER
CTOTAL
DCOUNT
Attempts:
3 left
💡 Hint
Common Mistakes
Using SUM(*) is invalid because SUM expects a numeric column.
TOTAL is not a standard SQL aggregate function.
NUMBER is not a SQL function.
3fill in blank
hard

Fix the error in the code to convert the 'name' column to uppercase using a built-in function.

SQL
SELECT [1](name) FROM users;
Drag options to blanks, or click blank then click option'
Alower
Bcapitalize
CUPPER
Dtitle
Attempts:
3 left
💡 Hint
Common Mistakes
Using lower() converts text to lowercase, not uppercase.
capitalize and title are not standard SQL functions.
4fill in blank
hard

Fill both blanks to select the average salary and round it to 2 decimal places.

SQL
SELECT ROUND(AVG([1]), [2]) FROM employees;
Drag options to blanks, or click blank then click option'
Asalary
B2
C3
Dbonus
Attempts:
3 left
💡 Hint
Common Mistakes
Using bonus instead of salary changes the meaning.
Rounding to 3 decimals when 2 is requested.
5fill in blank
hard

Fill all three blanks to select the maximum age, minimum age, and calculate the age difference in the 'people' table.

SQL
SELECT MAX([1]) AS max_age, MIN([2]) AS min_age, MAX(age) - MIN([3]) AS age_diff FROM people;
Drag options to blanks, or click blank then click option'
Aage
Bbirth_year
Dheight
Attempts:
3 left
💡 Hint
Common Mistakes
Using birth_year or height instead of age causes wrong results.
Mixing different columns in the calculation.