Skip to content

Final Exam :Databases and SQL for Data Science with Python (IBM Data Analyst Professional Certificate) Answers 2025

1. Question 1

The SELECT statement is called a ______.

  • ❌ Table name

  • ✅ Query

  • ❌ Function

  • ❌ Operator

Explanation:
SELECT is a query used to retrieve data.


2. Question 2

SQL to delete authors with IDs A10 and A11:

  • ✅ DELETE FROM AUTHOR WHERE AUTHOR_ID IN (‘A10’, ‘A11’)

  • ❌ AUTHOR_ID IS (…)

  • ❌ DELETE AUTHOR_ID IS (…)

  • ❌ DELETE (‘A10′,’A11’)

Explanation:
Use IN for multiple values:

DELETE FROM table WHERE column IN (...);

3. Question 3

Primary key uniquely identifies each ______.

  • ❌ attribute

  • ✅ row

  • ❌ relation

  • ❌ column

Explanation:
A primary key identifies each row (record).


4. Question 4

SQL command categories: DDL and ______.

  • ❌ DIL

  • ❌ DUL

  • ✅ DML

  • ❌ DEL

Explanation:
DDL (structure), DML (data manipulation: SELECT, INSERT, UPDATE).


5. Question 5

Query that returns number of reps per state:

  • ❌ SELECT State, COUNT(State)

  • ✅ SELECT State, COUNT(State) FROM Representative GROUP BY State

  • ❌ DISTINCT with COUNT incorrectly used

  • ❌ DISTINCT only (no counting)

Explanation:
Grouping is required for aggregation.


6. Question 6

Clause to list cities with 10,000–20,000 residents:

  • ✅ WHERE Residents BETWEEN 10000 AND 20000

  • ❌ WHERE Residents ARE BETWEEN

  • ❌ IN (10000,20000)

  • ❌ Residents 10000–20000

Explanation:
BETWEEN gives inclusive range filtering.


7. Question 7

Retrieve lowest salary:

  • ❌ LOWEST()

  • ❌ WHERE MINIMUM()

  • ✅ SELECT MIN(SALARY) FROM EMPLOYEES

  • ❌ MAX()

Explanation:
MIN() returns smallest value.


8. Question 8

Retrieve product name with lowest price:

  • ✅ SELECT PRODUCT_NAME FROM PRODUCTS WHERE UNIT_PRICE = (SELECT MIN(UNIT_PRICE) FROM PRODUCTS)

  • ❌ UNIT_PRICE IS LOWEST

  • ❌ UNIT_PRICE = MIN

  • ❌ SELECT MIN(UNIT_PRICE) only returns number, not product name

Explanation:
Use subquery to match the minimum price.


9. Question 9

A database cursor:

  • ❌ Does not allow updates

  • ✅ Enables traversal over records

  • ❌ Does not allow DB communication

  • ❌ Does not allow tables

Explanation:
A cursor moves row-by-row over query results.


10. Question 10

Meaning of:

df.to_sql('Sample', conn)
  • ✅ df – data frame; Sample – table name ; conn – connection variable

  • ❌ Other options

Explanation:
to_sql writes a DataFrame (df) into a database table (Sample) using a DB connection (conn).


🧾 Summary Table

Q Correct Answer Key Concept
1 Query SQL SELECT definition
2 DELETE WHERE … IN Deleting multiple rows
3 Row Primary key
4 DML SQL categories
5 GROUP BY State Aggregation
6 BETWEEN Range filtering
7 MIN(SALARY) Aggregates
8 Subquery with MIN() Minimum value retrieval
9 Cursor traverses rows DB cursor
10 df = DataFrame, Sample = table, conn = connection pandas → SQL