Challenge - 5 Problems
Dialect Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
Output difference due to string concatenation syntax
Consider the following SQL queries that concatenate first and last names. Which option returns the full name as 'John Doe' in PostgreSQL?
SQL
SELECT first_name || ' ' || last_name AS full_name FROM users WHERE id = 1;
Attempts:
2 left
💡 Hint
PostgreSQL uses || for string concatenation, not + or &.
✗ Incorrect
In PostgreSQL, the string concatenation operator is ||. Using + or & will cause errors or unexpected results.
📝 Syntax
intermediate2:00remaining
Syntax error due to LIMIT clause placement
Which SQL query will run without syntax errors in MySQL to get the top 5 rows ordered by salary descending?
Attempts:
2 left
💡 Hint
MySQL requires LIMIT after ORDER BY.
✗ Incorrect
In MySQL, LIMIT must come after ORDER BY. Using TOP or FETCH FIRST is not valid syntax in MySQL.
❓ optimization
advanced2:00remaining
Optimizing date filtering across SQL dialects
You want to select orders from 2023 in both MySQL and PostgreSQL. Which query is portable and efficient?
Attempts:
2 left
💡 Hint
Filtering by range on dates is usually faster and portable.
✗ Incorrect
Using a date range filter avoids function calls on columns, which helps indexes work efficiently and works across dialects.
🔧 Debug
advanced2:00remaining
Debugging NULL handling differences
Given the query to count non-null emails, which option correctly counts non-null emails in SQL Server?
SQL
SELECT COUNT(email) FROM customers;
Attempts:
2 left
💡 Hint
COUNT(column) ignores NULLs automatically.
✗ Incorrect
COUNT(column) counts only non-null values, so option D is correct and simplest. Option D also works but is redundant.
🧠 Conceptual
expert3:00remaining
Understanding dialect-specific transaction isolation levels
Which statement about transaction isolation levels is true across most SQL dialects?
Attempts:
2 left
💡 Hint
Think about the strictness of isolation levels and their effects.
✗ Incorrect
SERIALIZABLE is the strictest isolation level preventing phantom reads. Other levels vary in support and behavior across dialects.