Monday, August 29, 2011

SQL MIN FUNCTION


The SQL MIN aggregate function allows us to select the lowest (minimum) value for a certain column.
The SQL MIN function syntax is very simple and it looks like this: 


SELECT MIN(Column1)
FROM Table1

If we use the Company table from our previous chapters, we can select the lowest date of birth with the following SQL MIN expression: 


SELECT MIN(DOB) AS MinDOB
FROM Company


The result will look like this:



FirstName
LastName
Email
DOB
Phone
Scott
Armstrong
Armstrong.yahoo.com
2/4/1968
887-676-2321


MORE BASIC SQL COMMANDS


No comments:

Post a Comment