Download Version 5 - ChurchWatch

Transcript
The Query Manager
WHERE AMOUNT > 250 AND DATE_GIVEN > {1999.07.01}
ORDER BY DATE_GIVEN DESCENDING
Find all people born on a Sunday:
SELECT FIRST_NAME, FAMILY_NAM
FROM PEOPLE
WHERE DOW(BIRTHDATE) = 1
Get the average offering amount for each giving account and sort by account:
SELECT ACCOUNT, AVG(AMOUNT)
FROM GIVING
GROUP BY ACCOUNT
ORDER BY ACCOUNT
When searching for character strings an exact match is not necessary. To find all families whose last
name starts with “Sm” do this (use the UPPER function to ignore case):
SELECT * FROM HOUSE
WHERE UPPER(FAMILY_NAM) = “SM”
If an exact match is needed in the character string use two equal signs and the ALLT (trim all blanks)
function:
SELECT * FROM HOUSE
WHERE UPPER(ALLT(FAMILY_NAM)) == “SMITH”
Single or double quotes can be used:
SELECT * FROM HOUSE
WHERE UPPER(ALLT(FAMILY_NAM)) == ‘SMITH’
23-9