SQLfunctions

# SQLfunctions - DAYOFMONTH(birthdate = 14 use numbers so 14...

This preview shows page 1. Sign up to view the full content.

Functions we have learned in class to use as a reference Basic Setup of SQL: SELECT FROM WHERE Other Functions: GROUP BY (will be introduced on Thursday) HAVING (will be introduced on Thursday) ORDER BY Functions we have learned since starting 3.5BT material: SELECT DISTINCT No duplicate records CONCAT(last_name, ",", first_name) Hejase, Jose UPPER(first_name) JOSE LOWER(last_name ) hejase CHAR_LENGTH(first_name) 6 since my last name is composed of 6 letters MONTH(birthdate) = 7 use numbers (i.e. January=1, February=2, etc), so 7 would mean people born in July DAYOFWEEK(birthdate) IN (2,3) use numbers (i.e. Sunday=1, Monday=2, etc) and the comma means OR in this function
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: DAYOFMONTH(birthdate) = 14 use numbers so 14 would signify the fourteenth day of the month YEAR(NOW())-YEAR(birthdate) AS age Will take current year (i.e. 2007) and subtract from birth year to calculate an age Other Functions usually used together: (all these will be introduced on Thursday) MIN(DigitalFilesize) AS smallest Will give the minimum filesize found COUNT(SecondaryArtistID) AS NumberofSecondaryArtists Will calculate how many SecondaryArtistID records have been filled in AVG(DigitalFilesize) AS AverageSize Will calculate the average size of the files MAX(DigitalFilesize) AS largest Will give the maximum filesize found...
View Full Document

## This note was uploaded on 03/19/2008 for the course CSE 101 taught by Professor Allusethis during the Spring '08 term at Michigan State University.

Ask a homework question - tutors are online