Sql Tutorial Class


How to use max in SQL server

How to use max in SQL server


MAX in SQL Server: Max is an aggregate function of SQL Server. It is used to display the maximum value of the table. For example, user needs to the display maximum sale of product. The MAX aggregate function can also be used with SQL Select Where Statement.

Syntax:
        Select MAX[COLUMN_NAME] From [TABLE_NAME]

MAX Aggregate Function with SQL Select Where Statement:
          Select MAX[COLUMN_NAME] From [TABLE_NAME] Where [COLUMN_NAME]=['VALUE']




Example of without SQL Select Where command:

Select MAX(ItemQuantity) From ItemDetails
Select MAX(ItemPrice) from ItemDetails

SQL MAX in Image:
MAX function in sql server

SQL MAX in video:







Example of with SQL Select Where command:

Select MAX(ItemQuantity) from ItemDetails where ManufactureCompany='Samsung'
Select MAX(ItemQuantity) from ItemDetails where ManufactureCompany='Apple'
Select MAX(ItemQuantity) from ItemDetails where ManufactureCompany='DELL'
Select MAX(ItemQuantity) from ItemDetails where ProductCountry='ProductCounry'
Select MAX(ItemPrice) from ItemDetails where ManufactureCompany='Samsung'
Select MAX(ItemPrice) from ItemDetails where ManufactureCompany='DELL'
Select MAX(ItemPrice) from ItemDetails where ManufactureCompany='Apple'

Select MAX with Where Command, in Image:


Select MAX in SQL Server


SQL MAX with Select Where Statement in Video:

No comments:

Post a Comment