Database Reference
In-Depth Information
SELECT MAX(cookieID) +1
FROM
cookies
This will add one to the highest primary key that there is, and you can insert the results
straight into the table as the new primary key.
MIN
The MIN function is the opposite of MAX in that it calculates the minimum value from a
set of numeric values. So to find the lowest score that our visitors gave our website we would
use:
SELECT MIN(score)
FROM
visitorbook
The results are shown in Figure 10.8. The minimum score that any of our visitors has
given the website yet is 2 out of 20.
Figure 10.7
Finding the maximum of a set of values.
Figure 10.8
Finding the minimum of a set of values.
Search WWH ::




Custom Search