Jump to content
Cockroach

Is this correct for SQL MAX()

Recommended Posts

In working the "Try It Yourself" demo for the SQL MAX() command, the result does not make sense to me! Can someone help explain how the demonstrator came up with that result?

Edited by Cockroach

Share this post


Link to post
Share on other sites

That code is running in your browser, these days there is a way to create an actual database in your browser, so it's your browser that is running that code on the database that the site created.  You can see the list of tables in the database on the right side of the screen in the Try It editor.

It has this as the query that it's running:

SELECT MAX(Price) AS HighestPrice FROM Products;

And the result is 263.5.  Since it is selecting from the Products table, if you click on the Products table on the right side of the screen then it will list all 77 records in that table, and if you scroll through that table you'll find that the highest price is 263.5 for the product called Côte de Blaye.

Share this post


Link to post
Share on other sites

Ahhhhhh! Now I understand how this trainer works. On the previous page it only listed 5 items, top amount is 25! But there are other items in that database, you just have to know how to find them! Now, I do! Thank you so much!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×