Thursday, January 4, 2018

First Selects

Use Community_Assist;

SELECT 
  donationDate,
  donationAmount 
From 
 Donation;

Select * From Person
order by PersonLastName Desc

Select * From Person
order by PersonLastName, PersonFirstName

Select * From Person
order by PersonLastName desc, PersonFirstName 

Select * From Person
Where PersonLastName='Tanner'

Select * from PersonAddress

Select * from PersonAddress 
Where Not PersonAddressCity='Seattle'--!=, <>

Select * from PersonAddress
Where PersonAddressApt is null

Select * from PersonAddress
Where PersonAddressApt is not null

Select * from Donation
Where DonationDate > '1/1/2016'

Select * from Donation
Where DonationDate between '2/14/2016'
And '2/27/2016'

Select * from Donation 
Where DonationAmount >500 -- <, <=, >=

Select * from Person
Where PersonLastName Like 'F%'

Select * from Person
Where PersonLastName Like 'n%n'

Select * from Person
Where PersonLastName Like 'F_r%'

Select Top 5 DonationDate, Donationamount
From Donation
Order by Donationamount desc

Select DonationDate, Donationamount
From Donation
Order by Donationamount desc 
Offset 5 rows fetch next 5 rows only

Select Distinct personKey from Donation
order by PersonKey

No comments:

Post a Comment