🔥 $100K Hit! Where Will Bitcoin Go Next? Find Out Live!

Code has been added to clipboard!

SQL MAX with Examples

Reading time 1 min
Published Aug 9, 2017
Updated Oct 11, 2019

SQL MAX function returns the biggest data record value from the specified column.

Syntax of SQL MAX

Example
SELECT MAX(col_name)
FROM tbl_name
WHERE conditions;
DataCamp
Pros
  • Easy to use with a learn-by-doing approach
  • Offers quality content
  • Gamified in-browser coding experience
  • The price matches the quality
  • Suitable for learners ranging from beginner to advanced
Main Features
  • Free certificates of completion
  • Focused on data science skills
  • Flexible learning timetable
Udacity
Pros
  • Simplistic design (no unnecessary information)
  • High-quality courses (even the free ones)
  • Variety of features
Main Features
  • Nanodegree programs
  • Suitable for enterprises
  • Paid Certificates of completion
edX
Pros
  • A wide range of learning programs
  • University-level courses
  • Easy to navigate
  • Verified certificates
  • Free learning track available
Main Features
  • University-level courses
  • Suitable for enterprises
  • Verified certificates of completion

Demo Database

The demo database we'll use in our examples is called Products:

ID Name Supplier_ID Category_ID Unit Price Unit_in_stock Unit_on_order
1 Cucumber 3 3 5 crates 19 17 16
2 Tomato 3 3 6 crates 20 24 Null
3 Cheese 3 4 5 kg boxes 11 11 6
4 Milk 4 4 5 L bottles 22 56 12
5 Bread 4 4 36 boxes 26 26 1

SQL MAX Example

The code example below pick out the biggest 'PriceID' data record value in the table Products:

Example
SELECT MAX(Price) AS HighestPrice FROM Products;