Max() function in SQL Server

Max():- This function gives the maximum value of the selected column

Syntax:-

Select Max (col1) from table_name

In this article, we are going to use the following table for the examples:-

CREATE TABLE [dbo]. [Employee](
[Empid] [Int] IDENTITY (1, 1) NOT NULL Primary key,
[EmpNumber] [nvarchar](50) NOT NULL,
[EmpFirstName] [nvarchar](150) NOT NULL,
[EmpLAStName] [nvarchar](150) NULL,
[EmpEmail] [nvarchar](150) NULL,
[Salary] [int] NULL
)

We insert following data into the above tables:-

Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A001′,’Vivek’,’Johari’,’samir@abcmail.com’,200000)

Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A002′,’Abhinav’,’Golwalkar’,’abhinav@abcmail.com’,100000)

Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A003′,’Neha’,’Sharma’,’neha@abcmail.com’,300000)

Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A004′,’Chandra’,’Singh’,’vivek@abcmail.com’,320000)

Insert Into Employee (EmpNumber,EmpFirstName,EmpLAStName,EmpEmail,salary)
Values(‘A005′,’Avinash’, ‘Dubey’,’avinash@abcmail.com’,250000)

For example, query to get the maximum salary of an employee from the table Employee is given below:-

Select Max (salary) from Employee

It will gives the following result:-

320000

DMCA.com

About vivekjohari

Database Consultant with more than 11.5 years of experience in database designing & programming and DBA related activities.  Had good experience on different databases like SQL Server, MySQL & Oracle, Azure SQL &  Big Data.
This entry was posted in SQL Functions, SQL Server and tagged . Bookmark the permalink.

26 Responses to Max() function in SQL Server

  1. Pingback: apex legends season 2 trailer,

  2. Pingback: 카지노사이트

  3. Pingback: bong88

  4. Pingback: อยาก รี ไฟแนนซ์ บ้าน

  5. Pingback: https://internetnews.net.pl/forum/nowe-technologie-f7/poznam-opinie-o-funkymedia-t62.html

  6. Pingback: Website

  7. Pingback: https://www.olx.pl/

  8. Pingback: Nachfolger

  9. Pingback: Tochka Market

  10. Pingback: Agartha Market Exit Scam

  11. Pingback: Drogen kaufen

  12. Pingback: financial analysis industry

  13. Pingback: Darknet

  14. Pingback: Elastomer Stoppers Market Regional Data Analysis 2019-2027

  15. Pingback: สินเชื่อขอนแก่น

  16. Pingback: baccarat truc tuyen

  17. Pingback: ซีเกมส์ 2019

  18. Pingback: new santali 2013

  19. Pingback: qiuqiu99

  20. Pingback: เวดดิ้ง

  21. Pingback: Togel OnLine

  22. Pingback: khong vao duoc 12bet

  23. Pingback: manele noi 2020

  24. Pingback: chơi xổ số trực tuyến

  25. Pingback: poker 99

  26. Pingback: marketing for dummies

Leave a Reply