0
0
PostgreSQLquery~20 mins

PostgreSQL vs MySQL key differences - Practice Questions

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
PostgreSQL vs MySQL Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Primary focus difference between PostgreSQL and MySQL
Which statement best describes the primary design focus of PostgreSQL compared to MySQL?
APostgreSQL is designed mainly for web applications, whereas MySQL is for complex analytical queries.
BPostgreSQL emphasizes advanced SQL compliance and extensibility, while MySQL focuses on speed and ease of use.
CPostgreSQL supports only NoSQL data, while MySQL supports only relational data.
DPostgreSQL is a proprietary database, and MySQL is fully open source.
Attempts:
2 left
💡 Hint
Think about which database is known for advanced features and which is known for simplicity.
query_result
intermediate
2:00remaining
Output difference in handling JSON data
Given the following JSON column query in PostgreSQL and MySQL, which option correctly describes the difference in output behavior?
PostgreSQL
SELECT data->>'name' FROM users WHERE id = 1;
APostgreSQL returns the JSON field as text; MySQL returns an error because ->> is not supported.
BPostgreSQL returns the JSON field as JSON; MySQL returns text.
CBoth PostgreSQL and MySQL return the JSON field as text without error.
DMySQL returns the JSON field as text; PostgreSQL returns an error.
Attempts:
2 left
💡 Hint
Check which database supports the ->> operator for JSON extraction.
📝 Syntax
advanced
2:00remaining
Correct syntax for UPSERT in PostgreSQL vs MySQL
Which option shows the correct UPSERT syntax for PostgreSQL but would cause a syntax error in MySQL?
PostgreSQL
INSERT INTO products (id, name) VALUES (1, 'Pen') ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name;
AThe given query is valid in PostgreSQL but causes syntax error in MySQL.
BThe query causes syntax error in both PostgreSQL and MySQL.
CThe query is valid in MySQL but causes syntax error in PostgreSQL.
DThe query is valid in both PostgreSQL and MySQL.
Attempts:
2 left
💡 Hint
Consider which database supports ON CONFLICT syntax.
optimization
advanced
2:00remaining
Index type support difference affecting query optimization
Which index type is supported by PostgreSQL but not by MySQL, impacting optimization of full-text search queries?
AHASH
BBTREE
CGIN (Generalized Inverted Index)
DSPATIAL
Attempts:
2 left
💡 Hint
Think about which index type is specialized for full-text search in PostgreSQL.
🔧 Debug
expert
2:00remaining
Why does this PostgreSQL query fail but works in MySQL?
Consider this query executed in both databases:
SELECT * FROM orders WHERE order_date = '2023-02-30';

Why does it fail in PostgreSQL but not in MySQL?
ABoth databases reject the date, but MySQL error message is clearer.
BPostgreSQL automatically corrects invalid dates, MySQL does not.
CMySQL rejects invalid dates like '2023-02-30', PostgreSQL accepts them as valid dates.
DMySQL treats '2023-02-30' as NULL causing no results, PostgreSQL throws an error.
Attempts:
2 left
💡 Hint
Check how each database handles invalid date literals.