Graded Quiz: Refining Your Results :Databases and SQL for Data Science with Python (IBM Data Analyst Professional Certificate) Answers 2025
1. Question 1
Correct string pattern to find last names starting with J:
-
❌
J* -
❌
J$ -
✅
J% -
❌
J#
Explanation:
In SQL, the wildcard for matching any number of characters is %.
2. Question 2
Correct way to sort result set in descending order:
-
❌ SELECT ID …
-
✅ SELECT * FROM TABLE_NAME ORDER BY ID DESC
-
❌ ORDER BY ID
-
❌ ORDER BY ID
Explanation:
ORDER BY <column> DESC sorts descending.
The second option is the only fully correct SQL statement.
3. Question 3
Role of HAVING clause:
-
❌ May not organize result
-
✅ Restricts the result set for queries using GROUP BY
-
❌ Acts as alternative to WHERE
-
❌ Checks condition
Explanation:
HAVING filters after GROUP BY, whereas WHERE filters before grouping.
4. Question 4
Meaning of:
SELECT * FROM employees ORDER BY emp_name LIMIT 5;
-
❌ Top 5 emp_names only
-
✅ Retrieves all columns of the top 5 rows, sorted alphabetically by emp_name
-
❌ Reverse order
-
❌ Entire table
Explanation:
ORDER BY emp_name sorts alphabetically → LIMIT 5 shows first 5 rows.
5. Question 5
Correct SQL to list number of customers in each country where count > 5:
-
❌ COUNT(Customers)
-
✅ SELECT COUNT(CustomerID), Country FROM Customers GROUP BY Country HAVING COUNT(CustomerID) > 5;
-
❌ < 5
-
❌ HAVING CustomerID > 5
Explanation:
HAVING COUNT(CustomerID) > 5 filters countries with more than 5 customers.
🧾 Summary Table
| Q | Correct Answer | Key Concept |
|---|---|---|
| 1 | J% |
SQL LIKE wildcard |
| 2 | SELECT * … ORDER BY ID DESC | Sorting |
| 3 | HAVING filters after GROUP BY | HAVING vs WHERE |
| 4 | Top 5 rows sorted by name | LIMIT + ORDER BY |
| 5 | COUNT(CustomerID) > 5 | Grouping with HAVING |