

{"id":87263,"date":"2021-03-24T09:00:38","date_gmt":"2021-03-24T03:30:38","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=87263"},"modified":"2021-03-13T14:48:01","modified_gmt":"2021-03-13T09:18:01","slug":"sql-server-functions-syntax-examples","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/","title":{"rendered":"SQL Server Functions with Syntax and Examples"},"content":{"rendered":"<p>In this tutorial, we will study SQL Server Functions in detail.<\/p>\n<p>We have various functions in SQL some are specifically for strings, some are for numeric data types and likewise. Let us now dive deep into the SQL functions with syntax and examples all the way long.<\/p>\n<h3>What are SQL Server Functions?<\/h3>\n<p>In SQL, we have some built-in functions which help us to perform the specified tasks.<\/p>\n<p>These built-in functions help us to attain required results in avoiding complex queries and saving time in writing out large messy queries.<\/p>\n<p>In SQL, we have two basic bifurcations of built-in functions:<\/p>\n<h4>1. SQL Aggregate Functions<\/h4>\n<p>These functions help us to perform arithmetic operations on our attributes. These functions after operating return single values.<\/p>\n<p>Examples:<\/p>\n<ul>\n<li>SUM<\/li>\n<li>AVG<\/li>\n<li>MAX<\/li>\n<li>MIN etc.<\/li>\n<\/ul>\n<h4>2. SQL Scalar Functions<\/h4>\n<p>These functions are performed on string and DateTime type attributes. These functions also return single values upon operating on the given attribute.<\/p>\n<p>Examples:<\/p>\n<ul>\n<li>UCASE<\/li>\n<li>DAY<\/li>\n<li>YEAR<\/li>\n<li>LTRIM etc.<\/li>\n<\/ul>\n<h3>Types of SQL Server Functions<\/h3>\n<p>The divisions of functions can be made on various grounds but the most important one is based on the datatypes on which these functions can be applied.<\/p>\n<p>We have three major bifurcations:<\/p>\n<ol>\n<li>Aggregate Functions<\/li>\n<li>String Functions<\/li>\n<li>DateTime Functions<\/li>\n<\/ol>\n<p>In this tutorial, we will be focussing on the Aggregate Functions as we have already covered the String and DateTime functions in the previous tutorials.<\/p>\n<h3>SQL Demo Database<\/h3>\n<p>Let us now have a look at our demo database &#8211; DataFlair.<br \/>\n<strong>Query:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">USE DataFlair;\r\nSELECT * FROM DataFlair;\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/demo-database.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-87265\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/demo-database.png\" alt=\"SQL Demo Database\" width=\"1920\" height=\"1028\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/demo-database.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/demo-database-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/demo-database-1024x548.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/demo-database-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/demo-database-768x411.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/demo-database-1536x822.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/demo-database-720x386.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/demo-database-520x278.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/demo-database-320x171.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h3>SQL Aggregate Functions<\/h3>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Aggregate-Functions.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-87272\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Aggregate-Functions.jpg\" alt=\"SQL Aggregate Functions\" width=\"800\" height=\"750\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Aggregate-Functions.jpg 800w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Aggregate-Functions-300x281.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Aggregate-Functions-150x141.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Aggregate-Functions-768x720.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Aggregate-Functions-720x675.jpg 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Aggregate-Functions-520x488.jpg 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Aggregate-Functions-320x300.jpg 320w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<p>Aggregate functions are mathematical functions that are applied to the attributes in a database to get results. They help us to perform various mathematical and statistical operations on data without any additional efforts.<\/p>\n<p>We will now discuss each of the Aggregate functions in detail.<\/p>\n<h4>1. SQL AVG()<\/h4>\n<p>Allows us to find the average of any numerical attribute in our database.<br \/>\n<strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">SELECT AVG(col1) as average_val , col2, col3\u2026..\r\nFROM tableName;\r\n<\/pre>\n<p><strong>Example:<\/strong> Let us now try to find the average experience of employees at DataFlair.<br \/>\n<strong>Query:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">SELECT AVG(experience) AS Avg_Experience FROM DataFlair;\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/avg.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-87266\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/avg.png\" alt=\"sql avg()\" width=\"1920\" height=\"1032\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/avg.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/avg-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/avg-1024x550.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/avg-150x81.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/avg-768x413.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/avg-1536x826.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/avg-720x387.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/avg-520x280.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/avg-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>2. MIN() IN SQL<\/h4>\n<p>Allows us to find the minimum value of any numerical attribute without any additional efforts.<br \/>\n<strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">SELECT MIN(col1) as min_val , col2, col3\u2026..\r\nFROM tableName;\r\n<\/pre>\n<p><strong>Example:<\/strong> Let us now try to find the employee with the minimum experience in DataFlair.<br \/>\n<strong>Query:\u00a0<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">SELECT name, MIN(experience) as Exp, location FROM Dataflair;\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/min.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-87267\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/min.png\" alt=\"SQL Min()\" width=\"1920\" height=\"1032\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/min.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/min-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/min-1024x550.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/min-150x81.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/min-768x413.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/min-1536x826.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/min-720x387.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/min-520x280.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/min-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>3. MAX() in SQL<\/h4>\n<p>Helps us to find the max value of the numerical attributes in the database.<br \/>\n<strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">SELECT MAX(col1) as max_val , col2, col3\u2026..\r\nFROM tableName;\r\n<\/pre>\n<p><strong>Example:<\/strong> Let us now try to find the employee with the maximum experience in DataFlair.<br \/>\n<strong>Query:\u00a0<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">SELECT name, MAX(experience) as Exp, location FROM Dataflair;\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/max.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-87268\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/max.png\" alt=\"SQL MAX()\" width=\"1920\" height=\"1028\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/max.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/max-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/max-1024x548.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/max-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/max-768x411.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/max-1536x822.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/max-720x386.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/max-520x278.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/max-320x171.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>4. SUM() in SQL<\/h4>\n<p>Allows us to sum the numerical attributes in a column.<br \/>\n<strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">SELECT SUM(col1) as SUM_val , col2, col3\u2026..\r\nFROM tableName;\r\n<\/pre>\n<p><strong>Example:<\/strong> Let us now see what is the total experience of all employees when cumulated.<br \/>\n<strong>Query:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">SELECT SUM(experience) as Total_Exp FROM Dataflair;\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/sum.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-87269\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/sum.png\" alt=\"SQL SUM()\" width=\"1920\" height=\"1028\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/sum.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/sum-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/sum-1024x548.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/sum-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/sum-768x411.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/sum-1536x822.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/sum-720x386.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/sum-520x278.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/sum-320x171.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h4>5. COUNT() in SQL<\/h4>\n<p>Allows us to count the number of records in a particular attribute.<\/p>\n<p>It is more popularly used with the DISTINCT keyword to find the number of unique records in the database.<br \/>\n<strong>Syntax:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">SELECT COUNT(col1) as count_val , col2, col3\u2026..\r\nFROM tableName;\r\n<\/pre>\n<p>OR<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">SELECT COUNT(DISTINCT(col1)) as count_val , col2, col3\u2026..\r\nFROM tableName;\r\n<\/pre>\n<p><strong>Example 1: <\/strong>Let us first see the total number of employees in our DataFlair database.<br \/>\n<strong>Query:\u00a0<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">SELECT COUNT(emp_id) AS total_employees FROM DataFlair;\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-87270\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-1.png\" alt=\"SQL COUNT()\" width=\"1920\" height=\"1028\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-1.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-1-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-1-1024x548.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-1-150x80.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-1-768x411.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-1-1536x822.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-1-720x386.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-1-520x278.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-1-320x171.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<p><strong>Example 2:<\/strong> Let us now find the number of unique names in our DataFlair database.<br \/>\n<strong>Query:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">SELECT COUNT(DISTINCT(emp_id)) AS Unique_Names FROM DataFlair;\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-87271\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-2.png\" alt=\"COUNT() in SQL\" width=\"1920\" height=\"1032\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-2.png 1920w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-2-300x161.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-2-1024x550.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-2-150x81.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-2-768x413.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-2-1536x826.png 1536w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-2-720x387.png 720w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-2-520x280.png 520w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/count-2-320x172.png 320w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/a><\/p>\n<h3>Summary<\/h3>\n<p>In this tutorial, we have seen in detail the server functions of SQL.<\/p>\n<p>We have seen that they are divided into various bifurcations based on various parameters like the number of output and the data types on which they operate.<\/p>\n<p>Based on the outputs, they are divided into Scalar and Aggregate functions.<\/p>\n<p>When we talk about the data types on which they operate we can classify them into numeric functions, string functions, and DateTime functions. We have then seen in detail all the aggregate functions.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we will study SQL Server Functions in detail. We have various functions in SQL some are specifically for strings, some are for numeric data types and likewise. Let us now dive&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":87264,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66],"tags":[23860,23862,23861,23859,16741],"class_list":["post-87263","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql","tag-sql-aggregate-functions","tag-sql-max","tag-sql-min","tag-sql-server-functions","tag-sql-sum"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>SQL Server Functions with Syntax and Examples - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn about various SQL Server Functions like Aggregate Functions, String Functions and Date Time Functions with Syntax and Examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server Functions with Syntax and Examples - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn about various SQL Server Functions like Aggregate Functions, String Functions and Date Time Functions with Syntax and Examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-24T03:30:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Server-Functions.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL Server Functions with Syntax and Examples - DataFlair","description":"Learn about various SQL Server Functions like Aggregate Functions, String Functions and Date Time Functions with Syntax and Examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server Functions with Syntax and Examples - DataFlair","og_description":"Learn about various SQL Server Functions like Aggregate Functions, String Functions and Date Time Functions with Syntax and Examples.","og_url":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2021-03-24T03:30:38+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Server-Functions.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9"},"headline":"SQL Server Functions with Syntax and Examples","datePublished":"2021-03-24T03:30:38+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/"},"wordCount":584,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Server-Functions.jpg","keywords":["SQL Aggregate FUnctions","SQL MAX()","SQL Min()","SQL server functions","sql sum"],"articleSection":["SQL Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/","url":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/","name":"SQL Server Functions with Syntax and Examples - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Server-Functions.jpg","datePublished":"2021-03-24T03:30:38+00:00","description":"Learn about various SQL Server Functions like Aggregate Functions, String Functions and Date Time Functions with Syntax and Examples.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Server-Functions.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2021\/03\/Server-Functions.jpg","width":1200,"height":628,"caption":"SQL Server Functions"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/sql-server-functions-syntax-examples\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"SQL Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/sql\/"},{"@type":"ListItem","position":3,"name":"SQL Server Functions with Syntax and Examples"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/b49855299264df5e27e3ec6c2cd9fde9","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ef46b745ddad2fad690af626c6ef29b91809ad0a9f5ef398d07817d8cad042f5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team is a group of passionate educators and industry experts dedicated to providing high-quality online learning resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With years of experience in the field, the team aims to simplify complex topics and help learners advance their careers. At DataFlair, we believe in empowering students and professionals with the knowledge and skills needed to thrive in today\u2019s fast-paced tech industry. Follow us for Free courses, expert insights, tutorials, and practical tips to boost your learning journey.","url":"https:\/\/data-flair.training\/blogs\/author\/datafbdad\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/87263","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=87263"}],"version-history":[{"count":1,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/87263\/revisions"}],"predecessor-version":[{"id":87273,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/87263\/revisions\/87273"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/87264"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=87263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=87263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=87263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}