Write an SQL statement to display all columns of all rows of PET. Do not use theasterisk
Fantastic news! We've Found the answer you've been seeking!
Question:
Write an SQL statement to display all columns of all rows of PET. Do not use theasterisk (*) notation.
- 3.2 Write an SQL statement to display the breed, type, and DOB of all pets having the type Dog.
- 3.3 Write an SQL statement to display the PetBreed column of PET. Do not show duplicates.
- 3.4 Write an SQL statement to display the breed, type, and DOB for all pets having the type Dog and the breed Std. Poodle.
- 3.5 Write an SQL statement to display the name, breed, and type for all pets that are not of type Cat, Dog, or Fish.
- 3.6 Write an SQL statement to display the last name, first name, and email of all owners who have an email address ending with somewhere.com. Assume that email account names can be any number of characters. Note that the RTRIM function will be needed in the solution that uses a CHAR column, but not for one that uses a VARCHAR column.
- 3.7 Write an SQL statement to display the last name, first name and email of any owner who has a NULL value for OwnerPhone.
- 3.8 Write an SQL statement to display the name and breed of all pets, sorted by PetName.
- 3.9 Write an SQL statement to display the name and breed of all pets, sorted by PetBreed in ascendin order and by PetName in descending order within PetBreed.
- 3.10 Write an SQL statement to count the number of pets.
- 3.11 Write an SQL statement to display the minimum, maximum, and average weight of dogs.
- 3.12 Write an SQL statement to group the data by PetBreed and display the average weight per breed, but do not consider any pet having the breed of Unknown
- 3.13 Answer question 3.12, but consider only breeds for which two or more pets are included in the database.
- 3.14 Write an SQL statement to display the last name, first name, and email of any owners of cats. Use a subquery.
- 3.15 Write an SQL statement to display the OwnerLastName, OwnerFirstName, PetName,PetType, PetBreed, and AverageLifeExpectancy for pets with a known PetBreed.
Use the following tables for your answers to the questions
PET (PetID, PetName, PetType, PetBreed, PetDOB, OwnerID)
PET_3 (PetID, PetName, PetType, PetBreed, PetDOB, PetWeight, OwnerID)
PET_OWNER (OwnerID, OwnerLastName, OwnerFirstName, OwnerPhone, OwnerEmail)
BREED (BreedName, MinWeight, MaxWeight, AverageLifeExpectancy)
For each SQL statement you write, show the results based on these data.
Related Book For
Posted Date: