0% found this document useful (0 votes)
3K views9 pages

Integrated Project Access To Drinking Water

The document consists of a multiple-choice quiz with 10 questions related to SQL queries and data retrieval. Each question includes options, correct answers, and explanations for the reasoning behind the correct SQL queries. The quiz covers topics such as employee information, water source data, and pollution records.

Uploaded by

elitemizz6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3K views9 pages

Integrated Project Access To Drinking Water

The document consists of a multiple-choice quiz with 10 questions related to SQL queries and data retrieval. Each question includes options, correct answers, and explanations for the reasoning behind the correct SQL queries. The quiz covers topics such as employee information, water source data, and pollution records.

Uploaded by

elitemizz6
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Integrated project: Maji Ndogo part 1 [MCQ] (Version : 0)

TEST

Correct Answer
Answered in 62.97 Minutes

Question 1/10

What is the address of Bello Azibo?

51 Addis Ababa Road

119 Moroni Avenue

129 Ziwa La Kioo Road

100 Mogadishu Road

Explanation:

We can either search employees manually or use


'Bello Azibo' and the WHERE clause:

SELECT address
FROM employee
WHERE employee_name = 'Bello Azibo';

Question 2/10

What is the name and phone number of our Microbiologist?

Vuyisile Ghadir, +99317854629

Usafi Bahir, +99234156789


Vuyisile Ghadir, +99712584936

Jengo Tumaini, +99712584936

Explanation:

We can simply use a SELECT statement with


WHERE:

SELECT employee_name, phone_number


FROM employee
WHERE position = 'Micro Biologist';

Question 3/10

What is the source_id of the water source shared by the most number of people? Hint: Use a comparison
operator.

AmAs10911224

AkHa00036224

AkRu04862224

AkRu05603224

Explanation:

With our given experience and the hint given, we


can either use > with some number to hone in on
the answer:

SELECT *
FROM water_source
WHERE number_of_people_served > 3997;

or sort the list to find the top record:

SELECT *
FROM water_source
ORDER BY number_of_people_served DESC;

Question 4/10
What is the population of Maji Ndogo?

Hint: Start by searching the data_dictionary table for the word 'population'.

27,628.1 people

29.8 million people

146 million people

27.6 million people

Explanation:

Searching the data_dictionary for:

SELECT *
FROM data_dictionary WHERE description LIKE
'%population%' ;

Gives:

column
table_name description
_name

The national
population size
global_water_access pop_n
estimate in
thousands

The urban
population share
global_water_access pop_u estimate in
percentage points
(%)

From this we get the following information:

1. The population is in column pop_n.


2. It is in the global_water_access table.
3. The unit is in the thousands.

Searching the global_water_access table:

SELECT *
FROM global_water_access
WHERE name = 'Maji Ndogo';
Question 5/10

Which SQL query returns records of employees who areCivil Engineers residing in Dahabu or living on an
avenue?

SELECT *
FROM employee
WHERE position = 'Civil Engineer' AND
(province_name = 'Dahabu' OR address
LIKE '%Avenue%');

SELECT *
FROM employee
WHERE (position = 'Civil Engineer' AND
province_name = 'Dahabu') OR address
LIKE '%Avenue%';

SELECT *
FROM employee
WHERE position = 'Civil Engineer' AND
(province_name = 'Dahabu' OR address =
'Avenue');

SELECT *
FROM employee
WHERE position = 'Civil Engineer' AND
province_name = 'Dahabu' OR address
LIKE '%Avenue%';

Explanation:

The order of operations will influence the output.

The option that doesn’t include brackets is incorrect


because it will include employees with positions
other than 'Civil Engineer' as well. The option that
includes the bracket before position and after
'Dahabu' is incorrect because it will similarly include
employees with other positions. The option without
%, indicating a wildcard, will return nothing and is
therefore incorrect.

Question 6/10

Create a query to identify potentially suspicious field workers based on an anonymous tip. This is the description
we are given:
The employee’s phone number contained the digits 86 or 11.
The employee’s last name started with either an A or an M.
The employee was a Field Surveyor.

Which option is correct?

Only Bello Azibo fits this description.

Bello Azibo and Zuriel Matembo both fit


this description.

Four employees fit this description.

Only Zuriel Matembo fits this description.

Explanation:

Using the correct operators and brackets will


provide the correct answer:

SELECT employee_name
FROM employee
WHERE
(phone_number LIKE '%86%'
OR phone_number LIKE '%11%')
AND (employee_name LIKE '% A%'
OR employee_name LIKE '% M%')
AND position = 'Field Surveyor';

Without the brackets, four employees will be found


to match this description. Incorrectly applying the
brackets, many employees will be found to match
this description.

Question 7/10

What is the result of the following query? Choose the most appropriate description of the results set.

SELECT *
FROM well_pollution
WHERE description LIKE 'Clean_%' OR results = 'Clean' AND biological < 0.01;

4916 records are returned. This query


describes the pollution samples that had
an insignificant amount of biological
contamination.
4954 records are returned. This query
describes the pollution samples that had
an insignificant amount of biological
contamination.

4916 records are returned. This query


describes the pollution samples that were
classified as 'Clean' but were actually
contaminated.

0 records are returned. This query


describes the pollution samples that were
classified as 'Clean' but were actually
contaminated.

Explanation:

'4954 records' are incorrect because the changes


made in 5. Pollution Issues were not made, adding
those records to the total rows.

'0 records' are incorrect because… This is the


result of running the query we used to check the
incorrect labels in message 13:13. The conditions in
this question are reversed.

The statements that refer to 'classified as ‘Clean’


but were actually contaminated' are incorrect
because this query describes the pollution samples
where query conditions are reversed. Looking for
biological < 0.01 means we’re looking for records
below the threshold of 0.01, meaning there is an
insignificant amount of biological contamination in
these samples. Check message 12:31 for more
details.

Question 8/10

Which query will identify the records with a quality score of 10, visited more than once?

SELECT * FROM water_quality WHERE


visit_count > 1 AND
subjective_quality_score > 10

SELECT * FROM water_quality WHERE


visit_count = 2 OR
subjective_quality_score = 10

SELECT * FROM water_quality WHERE


visit_count >= 2 AND
subjective_quality_score = 10

SELECT * FROM water_quality WHERE


visit_count = 2 AND
subjective_quality_score = 10

Explanation:

The query that 'visit_count > 2 AND


subjective_quality_score = 10' is incorrect because
the AND operator will limit the result set to visit
count larger than two, excluding two.

The query with ‘visit_count = 2 AND


subjective_quality_score = 10’ is incorrect because
the AND operator will limit the result set to visit
count equals to two, excluding 3,4,5…

The query with ‘visit_count > 1 AND


subjective_quality_score > 10’, while visit_count > 1
is correct, ‘subjective_quality_score > 10’ will
always be false since there are no scores above
10.

Question 9/10

You have been given a task to correct the phone number for the employee named 'Bello Azibo'. The correct
number is +99643864786. Write the SQL query to accomplish this. Note: Running these queries on the
employee table may create issues later, so use the knowledge you have learned to avoid that.

UPDATE employee
SET phone_number = '+99643864786'
WHERE employee_name = 'Bello Azibo';

UPDATE employee
SET phone_number = '+99643864786'
WHERE name = 'Bello Azibo';

UPDATE employee
SET phone_number = '+99643864786';
UPDATE employee
SET phone_number = +99643864786
WHERE employee_name = 'Bello Azibo';

Explanation:

The option that includes UPDATE, SET, and


WHERE, quotation marks on the number, and uses
employee_name is correct. If the phone number is
not wrapped in quotation marks, it will result in a
syntax error.

If the WHERE clause is not used, this number will


be set for all employee records rather than just for
the single employee. If the column 'name' rather
than 'employee_name' is used, we are referring to a
non-existent column.

Question 10/10

How many rows of data are returned for the following query?

SELECT *
FROM well_pollution
WHERE description
IN ('Parasite: Cryptosporidium', 'biologically contaminated')
OR (results = 'Clean' AND biological > 0.01);

634 rows

750 rows

5486 rows

570 rows

Explanation:

'634 rows' is incorrect because the changes made


to the well_pollution table were not successful.
Either the updates were not made, or the
well_pollution_copy table was updated, and not
well_pollution.

'0 rows' and '750 rows' are false options.

You might also like