Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are using the PETS table in this exercise, Please complete the following ite

ID: 3592055 • Letter: Y

Question

You are using the PETS table in this exercise, Please complete the following items in SQL.

1.Write a query that will display only the names and colors of all of the dogs from the PETS table, ordered by their names

2.Write a query that will display only the names, birthdates of animals whose names start with H, in order of decreasing age (oldest pets first, youngest pets last).

3.Write a query that will display the name and birthdates for animals that are more than 3 years old (as of the due date of the homework assignment).

4.Write a query that will display all of the fields for animals that weigh more than 25 pounds, in alphabetical order of the pet's name.

5.Write a query that will display only the name, pet type, and color of the Outdoor pets, ordered by color

6.Write a query that will display only the name, pet type, and weight of all of the dogs and fish.

7.Write a query that will display all of fields for all of the animals that are pink or red.

8.Write a query that will display only the names and birthdates of all of the animals that weigh less than 20 pounds.

9.Write a query that will display only the names and pet types of all of the animals named Buddy, Chico, or Fluffy.

10.Write a query that will display only the names and birthdates of all of the horses.

11.Write a query that will display all fields for all animals.

12.Come up with your own query, make sure that it is unique and that it is not one that has already been done.

PETS Table.

R2 Actions COLUMN NAME NULLABLE DATA DEFAULTCOLUMN ID COMMENTS No DATA TYPE NUMBER (5,0) VARCHAR2 (30 BYTE) No VARCHAR2 (20 BYTE) No DATE 1PET ID 2 PET NAME 3 PET TYPE 4 PET DOB 5 PET WEIGHT NUMBER (5,0) 6 PET COLOR 7 PET_LOCATION VARCHAR2 (10 BYTE) No 8 PET DEATH (null) (null) (null) (null) (null) (null) (null) (null) l (null) 2 (null) 3 (null) 4 (null) 5 (null) 6 (null) 7 (null) 8 (null) No No VARCHAR2 (25 BYTE) No DATE No

Explanation / Answer

1. SELECT PET_NAME, PET_COLOR

FROM PETS

WHERE PET_TYPE = 'DOG'

ORDER BY PET_NAME;

2. SELECT PET_NAME, PET_DOB FROM PETS

WHERE PET_NAME LIKE 'H%'

ORDER BY PET_DOB;

3. SELECT PET_NAME, PET_DOB FROM PETS

WHERE PET_DOB < '2014-10-20'; /*assuming submission date as 10/20/2017 */

4. SELECT * FROM PETS

WHERE PET_WEIGHT > 25

ORDER BY PET_NAME;

5. SELECT PET_NAME, PET_TYPE, PET_COLOR FROM PETS

WHERE PET_LOCATION = 'OUTDOOR'

ORDER BY PET_COLOR;

6. SELECT PET_NAME, PET_TYPE, PET_WEIGHT FROM PETS

WHERE PET_TYPE IN ('DOG', 'FISH');

7. SELECT * FROM PETS

WHERE PET_COLOR IN ('PINK', 'RED');

8. SELECT PET_NAME, PET_DOB FROM PETS

WHERE PET_WEIGHT < 20;

9. SELECT PET_NAME, PET_TYPE FROM PETS

WHERE PET_NAME IN ('BUDDY', 'CHICO', 'FLUFFY');

10. SELECT PET_NAME, PET_DOB FROM PETS

WHERE PET_TYPE = 'HORSE';

11. SELECT * FROM PETS;

12. SELECT PET_ID, PET_NAME, PET_DOB FROM PETS

WHERE PET_COLOR='BLACK'

ORDER BY PET_NAME DESC;

This query will display pet id, name and birthdate of black colored animals and sort them/display them in reversed alphabetical order.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote