Graded Quiz on Assignment :Databases and SQL for Data Science with Python (IBM Data Analyst Professional Certificate) Answers 2025
1. Question 1
What is the total number of crimes recorded in the CRIME table?
-
✅ 533
-
❌ 555
-
❌ 433
-
❌ 53
Explanation:
Typical lab subset used in the course contains 533 rows for the CRIME table.
2. Question 2
Correct query to list community areas (number & name) with per capita income < 11000:
-
❌
SELECT COMMUNITY_AREA_NUMBER, COMMUNITY_AREA_NAME WHERE CENSUS_DATA FROM PER_CAPITA_INCOME<11000 -
❌
SELECT COMMUNITY AREA NUMBER, COMMUNITY_AREA_NAME FROM CENSUS_DATA WHERE PER_CAPITA_INCOME<11000(invalid column spacing) -
✅
SELECT COMMUNITY_AREA_NUMBER, COMMUNITY_AREA_NAME FROM CENSUS_DATA WHERE PER_CAPITA_INCOME<11000 -
❌
... WHERE PER_CAPITA_INCOME>11000
Explanation:
Third option has correct SELECT ... FROM ... WHERE syntax and correct column names.
3. Question 3
When you list all case numbers for crimes involving a minor, how many rows are retrieved?
-
❌ 3
-
✅ 4
-
❌ 2
-
❌ 1
Explanation:
In the lab dataset the filter for crimes involving a minor returns 4 case numbers.
4. Question 4
Query to identify kidnapping crimes involving a child:
-
❌
WHERE PRIMARY_TYPE = "KIDNAPPING"(too broad) -
✅
WHERE PRIMARY_TYPE = "KIDNAPPING" AND DESCRIPTION LIKE "%CHILD%" -
❌
WHERE DESCRIPTION LIKE "%CHILD%"(may miss records labeled as kidnapping without the word child) -
❌
AND DESCRIPTION = “%CHILD%”(invalid use of=with wildcard)
Explanation:
Correct approach: filter primary type and use LIKE '%CHILD%' to catch DESCRIPTION text mentioning child.
5. Question 5
Which two clauses were used to get the unique list of crime types recorded in schools?
-
❌ COUNT
-
❌ AVERAGE
-
✅ DISTINCT
-
✅ LIKE
Explanation:
You’d use DISTINCT to get unique crime types and LIKE in the WHERE clause (e.g. LOCATION_DESCRIPTION LIKE '%SCHOOL%') to limit to school locations.
6. Question 6
What was the average safety score for middle schools?
-
❌ 46.42
-
❌ 49.52
-
✅ 49.62
-
❌ 48.0
Explanation:
Lab summary shows the mean safety score for middle schools as 49.62.
7. Question 7
What to add to list five community areas with highest % households below poverty?
-
❌
ORDER BY PERCENT_HOUSEHOLDS_BELOW_POVERTY LIMIT 5(missing DESC) -
❌
ORDER BY PERCENT_HOUSEHOLDS_BELOW_POVERTY DESC LIMIT(missing limit value) -
❌
ORDER BY PERCENT_HOUSEHOLDS_BELOW_POVERTY DESC(missing LIMIT) -
✅
ORDER BY PERCENT_HOUSEHOLDS_BELOW_POVERTY DESC LIMIT 5
Explanation:
Sort descending and limit to 5: ORDER BY ... DESC LIMIT 5.
8. Question 8
Which community area number has the most criminal incidents?
-
❌ 36.0
-
✅ 25.0
-
❌ 20.0
-
❌ 23.0
Explanation:
In the lab dataset community area 25.0 (Austin) has the highest count of incidents.
9. Question 9
Correct sub-query to find the community area name with the highest hardship index:
-
❌
... WHERE HARDSHIP_INDEX IN (SELECT MOST(HARDSHIP_INDEX)...)(MOST not valid) -
❌
... WHERE HARDSHIP_INDEX AS (SELECT MAX(...))(invalid syntax) -
✅
SELECT COMMUNITY_AREA_NAME FROM CENSUS_DATA WHERE HARDSHIP_INDEX IN (SELECT MAX(HARDSHIP_INDEX) FROM CENSUS_DATA); -
❌ incomplete/invalid option
Explanation:
Use MAX(...) in a subquery and match HARDSHIP_INDEX to that value.
10. Question 10
What is the name of the community with the most number of crimes?
-
❌ Englewood
-
✅ Austin
-
❌ Riverdale
-
❌ Fuller Park
Explanation:
Based on the lab subset, Austin (community area 25) has the largest number of crimes.
🧾 Summary Table
| Q | Answer | Key idea |
|---|---|---|
| 1 | 533 | Total rows in CRIME table (lab subset) |
| 2 | SELECT … FROM CENSUS_DATA WHERE PER_CAPITA_INCOME<11000 | Correct SQL syntax |
| 3 | 4 | Rows with crimes involving minors |
| 4 | PRIMARY_TYPE=’KIDNAPPING’ AND DESCRIPTION LIKE ‘%CHILD%’ | Narrow kidnapping + child |
| 5 | DISTINCT, LIKE | Unique types + filter by school |
| 6 | 49.62 | Mean safety score for middle schools |
| 7 | ORDER BY … DESC LIMIT 5 | Top 5 by poverty % |
| 8 | 25.0 | Community area number with most incidents |
| 9 | WHERE HARDSHIP_INDEX IN (SELECT MAX(…)) | Subquery with MAX |
| 10 | Austin | Community with most crimes |