0% found this document useful (0 votes)
2 views4 pages

Questions

The document contains a series of SQL statements designed to query animal data from a database. It includes requests for various details about animals, such as family names, enclosure sizes, endangered statuses, and visit records, along with specific conditions and sorting requirements. Each section specifies the expected output, including the number of records returned for each query.

Uploaded by

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

Questions

The document contains a series of SQL statements designed to query animal data from a database. It includes requests for various details about animals, such as family names, enclosure sizes, endangered statuses, and visit records, along with specific conditions and sorting requirements. Each section specifies the expected output, including the number of records returned for each query.

Uploaded by

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

#1.

1
Write an SQL statement that displays all the animals details.
(46 records)#
#1.2
Write an SQL statement the displays all the animals details that have the Felidae
family name.
(9 records)#
#1.3
Write an SQL statement that displays the scientific name, general name and
enclosure size of all the animals that have more than
100 units in enclosure size.
(4 records)#
#1.4
Write an SQL statement that displays the general name and number of adults of all
the animals with exactly 5 adults.
(2 records)#
#1.5
Write an SQL statement that displays the scientific name, general name and
endangered status of all the animals with a Vulnerable endangered status.
(4 records)#
#1.6
Write an SQL statement that displays all the animals details of all animals EXCEPT
those with a Vulnerable endangered status.
(42 records)#
#1.7
Write an SQL statement that displays the general name of all the animals that have
no young animals in the reserve.
(6 records)#
#2.1
Write an SQL statement that displays all the animals details of all animals with 5
or more number of adults and 5 or more number of young.
(3 records)#
#2.2
Write an SQL statement that displays the scientific name, general name, number of
young and enclosure size of all the animals with an enclosure size of 400 units or
greater and at least 2 young animals.
(3 records)#
#2.3
Write an SQL statement the displays all the animals details that have the Canidae
family name and at least 6 adults.
(2 records)#
#2.4
Write an SQL statement that displays the scientific name, general name and
enclosure size of all the animals that have no young animals and that DO NOT have
Not evaluated as an endangered status.
(5 records)#
#2.5
Write an SQL statement that displays the general name, number of adults and number
of young of all the animals with have no adults or no young.
(7 records)#
#2.6
Write an SQL statement that displays the scientific name, general name and
endangered status of all the animals with a Vulnerable and Endangered endangered
status.
(6 records)#
#3.1
Write an SQL statement that displays all the animals details of all animals without
an enclosure size.
(2 records)#
#3.2
Write an SQL statement that displays the general name and enclosure size of all the
animals with an enclosure size.
(44 records)#
#3.3
Write an SQL statement the displays all the animals details that have the Canidae
family name and an enclosure size of 50 to 60 (inclusive).
(3 records)#
#3.4
Write an SQL statement that displays the family name, scientific name and general
name of all the animals of the Mustelidae, Hyaenidae, Viverridae and Bradypodidae
families.
(13 records)#
#3.5
Write an SQL statement that displays the general name of all the animals with a
general name from C to any animal starting with the letter E.
(11 records)#
#4.1
Write an SQL statement that displays all the animals details of all animals in the
ZD enclosures.
NOTE: If using wild card symbols, use % instead of * and _ instead of ?.
(10 records)#
#4.2
Write an SQL statement that displays visit date and reason of visit of all the vet
visits that deal with some sort of injury.
NOTE: If using wild card symbols, use % instead of * and _ instead of ?.
(5 records)#
#4.3
Write an SQL statement the displays all the animals details of all the seals
(general name).
NOTE: If using wild card symbols, use % instead of * and _ instead of ?.
(7 records)#
#4.4
Write an SQL statement that displays the family name, scientific name and general
name of all the animals with a general name of only 7 letters.
NOTE: If using wild card symbols, use % instead of * and _ instead of ?.
(5 records)#
#4.5
Write an SQL statement that displays the general name of all the animals with a
general name of only 5 letters that ends in the letter R.
NOTE: If using wild card symbols, use % instead of * and _ instead of ?.
(1 – Tiger)#
#4.6
Write an SQL statement that displays the general name and number of young of all
the mongooses with 1 or less young.
NOTE: If using wild card symbols, use % instead of * and _ instead of ?.
(3 records)#
#5.1
Write an SQL statement that displays all the animals details of in alphabetically
order according to their general name.
(Aardwolf to Yellow mongoose)#
#5.2
Write an SQL statement that displays the general name, scientific name and
enclosure size of all the animals in the Canidae family sorted from biggest
enclosure to the smallest.
(African wild dog to Cape fox)#
#5.3
Write an SQL statement the displays a list of all the family names without any
duplicates of all the animals.
(9 records)#
#5.4
Write an SQL statement the displays a list of all the reasons to visit without any
duplicates of all the vet visits.
(12 records)#
#5.5
Write an SQL statement that displays the enclosure number, general name, visit date
and reason for visit of all those that have a skin problem as the reason for the
visit. Sort by visit date.
(5 records)#
#5.6
Write an SQL statement that displays the enclosure number, general name, endangered
status, reason for visit, and follow up status of all the Vulnerable animals that
need a have had a follow up visit (true).
(1 = Cheetah)#
#6.1
Write an SQL statement that displays all the general name, number of adults, number
of young and a calculated TotalAnimals field that shows the total number of adults
and young for each animal.
(Cheetah is 3 TotalAnimals)#
#6.2
Write an SQL statement that displays the general name, scientific name, enclosure
size and a calculated AnimalRatio field which is the enclosure size divided by the
sum of the number of adults and young). This field must be displayed to 2 decimal
places.
(Cheetah is 16.67 AnimalRatio)#
#6.3
All Hyaenidae cost R3000 per adult to feed and R1200 per young to feed every month.
Write an SQL statement the displays a list of all the family names, general names,
number of adults, number of young and a calculated MonthlyTotal field that displays
how much to feed all that family name every month. Display the MonthlyTotal as a
currency.
(Spotted hyena is R34 200.00 MonthlyTotal)#
#6.4
Write an SQL statement the displays the general name and a calculated MoreAdults
field that shows the difference between the number of adults and the number of
young but only for those animals where there are more adults then young.
(26 records, Cheetah is 1 MoreAdults)#
#6.5
Write an SQL statement that displays the family name, general name and number of
adults of all the animals that have an EVEN number of number of adults. (Hint: Use
the INT function).
(27 records)#
#7.1
Write an SQL statement that displays the visit ID, visit date and reason for visit
of all those visits the occurred in the first week of September 2019.
(8 records)#
#7.2
Write an SQL statement that displays the visit ID, visit date and reason for visit
of all those visits the occurred in September 2019 and that need a follow up
(false).
(22 records)#
#7.3
Write an SQL statement that displays the visit ID, visit date and a calculated
DaysTillVisit that displays the number of days from the current date since the
visit date.
(results dependant on current date)#
#7.4
Write an SQL statement that displays the visit ID, visit date, reason to visit and
a calculated NextCheckup that displays the date of the next check-up which is 60
days after the visit date. This is only for the vet visits that are routine check-
ups.
(21 records)#
#8.1
Write an SQL statement that displays the MOST number of adults of all animals.
(Answer = 9)#
#8.2
Write an SQL statement that displays the AVERAGE enclosure size of only the Felidae
family.
Round your answer to TWO decimal places.
(Answer = 1193.11)#
#8.3
Write an SQL statement that displays the MOST number of young for EACH family.
(Canidae = 4)#
#8.4
Write an SQL statement that displays the average number of adults for EACH family
where the average is 5 or more.
(Records = 2, Viverridae = 5)#
#8.5
Write an SQL statement that displays the average number of animals (adults and
young combined) for EACH family where they are sorted in descending order of the
average number of animals.
(9 records, Hyaenidae = 8 at top)#
#9.1
Write an SQL statement that displays the general name and scientific name of all
the animals that have the word cat at the end of the general name (You may NOT use
the LIKE operator).
(3 records)#
#9.2
Write an SQL statement that displays the general name and the calculated length of
the general name (LengthOfName) for all animals.
(see results in query)#
#9.3
Write an SQL statement that displays the number of characters in the scientific
name with the MOST characters.
(Answer = 24)#
#9.4
Write an SQL statement that displays all the details as well as a calculated
AnimalCode field that is made of first THREE letters of the general name, last two
characters of the enclosure number, characters 2 to 4 of the scientific name and
lastly the number of adults (use the STR function to convert NumAdults to text).
The whole AnimalCode must be in capital letters.
(Cheetah = CHEA1CIN 2)#
#10.1
NOTE: Read the Mr Long Summary on subqueries then complete part 10.
Write an SQL statement that displays the general name and the calculated
TotalAnimals (number of adults and young combined) of all the animals where the
total animals is ABOVE the average total (adults and young) of all animals.
(23 records)#
#10.2
NOTE: Read the Mr Long Summary on subqueries then complete part 10.
Write an SQL statement that displays the AVERAGE total animals (adults and young
combined) for EACH family where the average total of that family is above the
average total (adults and young) of all animals, sorted in descending order
according to the average total animals.
(6 records, Hyaenidae = 8 at top)#

You might also like