Bird
Raised Fist0
SQLquery~20 mins

MySQL vs PostgreSQL vs SQL Server overview - Practice Questions

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Database Master: MySQL vs PostgreSQL vs SQL Server
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Which database supports JSON data type natively?
Among MySQL, PostgreSQL, and SQL Server, which one supports JSON as a native data type allowing efficient querying and indexing?
ABoth MySQL and PostgreSQL support JSON natively.
BOnly PostgreSQL supports JSON natively.
COnly MySQL supports JSON natively.
DNone of them support JSON natively.
Attempts:
2 left
💡 Hint
Think about which databases allow storing JSON documents and querying them efficiently.
❓ query_result
intermediate
2:00remaining
Identify the database by its default case sensitivity in string comparisons
Given the following behavior: String comparisons are case-insensitive by default in this database. Which database is it?
AMySQL
BPostgreSQL
CSQL Server
DAll three are case-sensitive by default
Attempts:
2 left
💡 Hint
Consider which database treats 'abc' and 'ABC' as equal by default in WHERE clauses.
📝 Syntax
advanced
2:00remaining
Which SQL syntax is valid for limiting query results in all three databases?
You want to limit the number of rows returned by a query to 5. Which of the following SQL statements will work correctly in MySQL, PostgreSQL, and SQL Server?
SQL
SELECT * FROM employees FETCH FIRST 5 ROWS ONLY;
ASELECT * FROM employees WHERE ROWNUM <= 5;
BSELECT TOP 5 * FROM employees;
CSELECT * FROM employees LIMIT 5;
DSELECT * FROM employees FETCH FIRST 5 ROWS ONLY;
Attempts:
2 left
💡 Hint
Think about the SQL standard syntax supported by all three databases.
❓ optimization
advanced
2:00remaining
Which database supports partial indexes for query optimization?
Partial indexes allow indexing only a subset of rows in a table. Which database supports partial indexes natively?
APostgreSQL
BMySQL
CSQL Server
DNone of them support partial indexes
Attempts:
2 left
💡 Hint
Think about which database allows creating indexes with a WHERE clause.
🔧 Debug
expert
3:00remaining
Why does this SQL Server query fail but works in MySQL and PostgreSQL?
Consider this query: SELECT * FROM orders WHERE order_date = '2023-02-30'; It runs (with warning) in MySQL but fails in SQL Server and PostgreSQL. Why?
ASQL Server requires dates to be in ISO 8601 format only.
BMySQL automatically converts invalid dates to NULL silently.
CSQL Server strictly validates date literals and '2023-02-30' is invalid.
DMySQL treats all strings as valid dates regardless of format.
Attempts:
2 left
💡 Hint
Think about how each database handles invalid date values.

Practice

(1/5)
1. Which database system is known for easy setup and is commonly used in web projects?
easy
A. Oracle
B. PostgreSQL
C. SQL Server
D. MySQL

Solution

  1. Step 1: Understand the common uses of MySQL

    MySQL is widely recognized for its easy installation and is popular in web development.
  2. Step 2: Compare with other databases

    PostgreSQL is more feature-rich for complex queries, and SQL Server is suited for Windows business environments.
  3. Final Answer:

    MySQL -> Option D
  4. Quick Check:

    Easy setup and web use = MySQL [OK]
Hint: Think 'easy web projects' and pick MySQL [OK]
Common Mistakes:
  • Confusing PostgreSQL with MySQL
  • Choosing SQL Server for web projects
  • Choosing Oracle, which is enterprise-focused
2. Which of the following is the correct way to start a SQL Server service on Windows using command line?
easy
A. service start sqlserver
B. net start MSSQLSERVER
C. systemctl start sqlserver
D. start-service sqlserver

Solution

  1. Step 1: Identify Windows command for services

    On Windows, the command to start services is 'net start' followed by the service name.
  2. Step 2: Recognize SQL Server service name

    The default SQL Server service is named MSSQLSERVER, so the command is 'net start MSSQLSERVER'.
  3. Final Answer:

    net start MSSQLSERVER -> Option B
  4. Quick Check:

    Windows service start = net start MSSQLSERVER [OK]
Hint: Windows services start with 'net start' [OK]
Common Mistakes:
  • Using Linux commands like systemctl
  • Using incorrect service names
  • Confusing PowerShell commands
3. Given the following SQL query run on PostgreSQL:
SELECT LENGTH('Hello World');

What will be the output?
medium
A. 10
B. 12
C. 11
D. Error

Solution

  1. Step 1: Understand LENGTH function in PostgreSQL

    The LENGTH function returns the number of characters in the string.
  2. Step 2: Count characters in 'Hello World'

    There are 11 characters including the space between Hello and World.
  3. Final Answer:

    11 -> Option C
  4. Quick Check:

    Count characters including space = 11 [OK]
Hint: Count all characters including spaces [OK]
Common Mistakes:
  • Ignoring the space character
  • Confusing LENGTH with LEN
  • Expecting error due to function name
4. You try to run this query on MySQL:
SELECT TOP 5 * FROM users;

But it gives an error. What is the problem?
medium
A. MySQL does not support SELECT TOP syntax
B. Missing WHERE clause
C. Table 'users' does not exist
D. Incorrect use of semicolon

Solution

  1. Step 1: Recognize SELECT TOP syntax usage

    SELECT TOP is used in SQL Server to limit rows, but MySQL uses LIMIT.
  2. Step 2: Identify correct MySQL syntax

    In MySQL, the query should be: SELECT * FROM users LIMIT 5;
  3. Final Answer:

    MySQL does not support SELECT TOP syntax -> Option A
  4. Quick Check:

    MySQL uses LIMIT, not TOP [OK]
Hint: MySQL uses LIMIT, not TOP [OK]
Common Mistakes:
  • Assuming TOP works in MySQL
  • Thinking WHERE is mandatory
  • Blaming semicolon usage
5. You want to use a database system that supports advanced JSON querying and complex data types for a data analytics project. Which database is the best choice?
hard
A. PostgreSQL
B. MySQL
C. SQL Server
D. SQLite

Solution

  1. Step 1: Identify database strengths for complex data

    PostgreSQL is known for powerful features including advanced JSON support and complex data types.
  2. Step 2: Compare with other options

    MySQL has JSON support but less advanced; SQL Server supports JSON but is more Windows-focused; SQLite is lightweight and limited.
  3. Final Answer:

    PostgreSQL -> Option A
  4. Quick Check:

    Advanced JSON and complex data = PostgreSQL [OK]
Hint: Pick PostgreSQL for complex data and JSON [OK]
Common Mistakes:
  • Choosing MySQL for advanced JSON
  • Selecting SQL Server for cross-platform JSON
  • Picking SQLite for heavy analytics
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard