Assingment 4 Chapter 3 SELECT

docx

School

SUNY Westchester Community College *

*We aren’t endorsed by this school

Course

345

Subject

Computer Science

Date

Dec 6, 2023

Type

docx

Pages

3

Uploaded by ChefKangaroo5835

Report
Assignment 4 Chapter 3: SELECT 3.15 Write a SQL statement to display all columns of all rows of PET. Do not use the asterisk (*) notation. SELECT PetID,PetName,PetType,PetBreed,PetDOB,OwnerID FROM PET; 3.16 Write a SQL statement to display all columns of all rows of PET. Use the asterisk (*) notation. SELECT * FROM PET; 3.17 Write a SQL statement to display the breed and type of all pets. SELECT PetBreed, PetType FROM PET; 3.18 Write a SQL statement to display the breed, type, and DOB of all pets having the type Dog. SELECT PetBreed, PetType, PetDOB FROM PET WHERE PetType = 'Dog' ; 3.19 Write an SQL statement to display the PetBreed column of PET. SELECT PetBreed, FROM PET; 3.20 Write a SQL statement to display the PetBreed column of PET. Do not show duplicates. SELECT DISTINCT PetBreed, FROM PET; 3.21 Write a SQL statement to display the breed, type, and DOB for all pets having the type of Dog and the breed Std. Poodle. SELECT PetBreed, PetType, PetDOB FROM PET WHERE PetType = 'Dog' AND PetBreed = 'Std. Poodle'; 3.22 Write an SQL statement to display the name, breed, and type for all pets that are not of type Cat, Dog, and Fish.
SELECT PetBreed, PetType, PetDOB FROM PET WHERE PetType NOT IN ('Dog','Cat','Fish') ; 3.23 Write an SQL statement to display the pet ID, breed, and type for all pets having a four-character name starting with K SELECT PetID, PetBreed, PetType, FROM PET WHERE RTRIM(PetName) is like 'K'; 3.24 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. SELECT OwnerLastName, OwnerFirstName, OwnerEmail, FROM PET_Owner WHERE RTRIM (OwnerEmail) is like '%somewhere.com'; 3.25 Write an SQL statement to display the last name, first name, and email of any owner who has a NULL value for OwnerPhone. SELECT OwnerLastName, OwnerFirstName, OwnerEmail, FROM PET_Owner WHERE OwnerPhone is NULL; 3.26 Write an SQL statement to display the name and breed of all pets, sorted by PetName SELECT PetName,PetBreed FROM PET ORDER BY PetName; 3.27 Write an SQL statement to display the name and breed of all pets, sorted by PetBreed in ascending order and by PetName in descending order within PetBreed SELECT PetName,PetBreed FROM PET_2 ORDER BY PetBreed ASC, PetName DESC; 3.28 Write an SQL statement to count the number of pets. SELECT Count(*) as NumberofPets FROM PET; 3.29 Write and SQL statement to count the number of distinct breeds.
SELECT Count(DISTICNT PetBreed) as NumberofPets FROM PET;
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help