0
0
SQLquery~20 mins

Why dialect awareness matters in SQL - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Dialect Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2: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;
ASELECT first_name + ' ' + last_name AS full_name FROM users WHERE id = 1;
BSELECT first_name || ' ' || last_name AS full_name FROM users WHERE id = 1;
CSELECT first_name & ' ' & last_name AS full_name FROM users WHERE id = 1;
DSELECT CONCAT(first_name, ' ', last_name) AS full_name FROM users WHERE id = 1;
Attempts:
2 left
💡 Hint
PostgreSQL uses || for string concatenation, not + or &.
📝 Syntax
intermediate
2: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?
ASELECT TOP 5 * FROM employees ORDER BY salary DESC;
BSELECT * FROM employees LIMIT 5 ORDER BY salary DESC;
CSELECT * FROM employees ORDER BY salary DESC LIMIT 5;
DSELECT * FROM employees FETCH FIRST 5 ROWS ONLY ORDER BY salary DESC;
Attempts:
2 left
💡 Hint
MySQL requires LIMIT after ORDER BY.
optimization
advanced
2: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?
ASELECT * FROM orders WHERE order_date >= '2023-01-01' AND order_date < '2024-01-01';
BSELECT * FROM orders WHERE TO_CHAR(order_date, 'YYYY') = '2023';
CSELECT * FROM orders WHERE EXTRACT(YEAR FROM order_date) = 2023;
DSELECT * FROM orders WHERE YEAR(order_date) = 2023;
Attempts:
2 left
💡 Hint
Filtering by range on dates is usually faster and portable.
🔧 Debug
advanced
2: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;
ASELECT COUNT(*) FROM customers WHERE email IS NOT NULL;
BSELECT COUNT(email) FROM customers WHERE email IS NOT NULL;
CSELECT COUNT(DISTINCT email) FROM customers;
DSELECT COUNT(email) FROM customers;
Attempts:
2 left
💡 Hint
COUNT(column) ignores NULLs automatically.
🧠 Conceptual
expert
3:00remaining
Understanding dialect-specific transaction isolation levels
Which statement about transaction isolation levels is true across most SQL dialects?
ASERIALIZABLE isolation level guarantees no phantom reads and is the strictest level.
BREAD UNCOMMITTED allows dirty reads and is supported by all major SQL databases.
CREAD COMMITTED isolation level prevents dirty reads and phantom reads in all databases.
DREPEATABLE READ isolation level is the weakest isolation level.
Attempts:
2 left
💡 Hint
Think about the strictness of isolation levels and their effects.