sql functions Archives - {coding}Sight https://codingsight.com/tag/sql-functions/ Blog for SQL Server DBAs and Developers Thu, 14 Mar 2024 21:25:42 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.2 https://codingsight.com/wp-content/uploads/2021/10/cropped-Soсial_-Fb_180х180-1-32x32.png sql functions Archives - {coding}Sight https://codingsight.com/tag/sql-functions/ 32 32 How to Get SQL Percentage Calculation as Easy as Pie  https://codingsight.com/sql-percentage-calculation/ Thu, 14 Mar 2024 15:54:32 +0000 https://codingsight.com/?p=26091 Percentage calculation in SQL can be a bit like traversing an unfamiliar labyrinth. If you’re a beginner, it’s easy to get lost in a maze of numbers and functions. You may stumble over pitfalls that can lead to incorrect results. But fear not because we’re about to make SQL percentage calculations as easy as pie!  …

The post How to Get SQL Percentage Calculation as Easy as Pie  appeared first on {coding}Sight.

]]>
SQL Aggregate Functions: Easy Tips for Newbies https://codingsight.com/what-are-sql-aggregate-functions-easy-tips-for-newbies/ Wed, 28 Sep 2022 07:59:00 +0000 http://codingsight.com/?p=15123 SQL Aggregate Functions are functions that perform calculations and return a summarized result. With these, it’s easy to do these calculations on data sets: But there’s more. Statistical calculations like standard deviation and variance are also part of the tools. Mix it with grouping and sorting, and you’ll have something fantastic for your new report. So, …

The post SQL Aggregate Functions: Easy Tips for Newbies appeared first on {coding}Sight.

]]>
SQL Cheat Sheet: What is SQL, SQL Commands, and SQL Injection https://codingsight.com/sql-cheat-sheet-what-is-sql-sql-commands-and-sql-injection/ Wed, 20 Oct 2021 08:04:10 +0000 http://codingsight.com/?p=19098 Using Structured Query Language (SQL) can seem complicated at first, but further, it will become easier and much more convenient. You only need practice. If you are looking for better ways to manage data in your database or if you are simply curious about the possibilities that SQL opens up to you, then you have …

The post SQL Cheat Sheet: What is SQL, SQL Commands, and SQL Injection appeared first on {coding}Sight.

]]>
How to Use SQL Server T-SQL Function SUM: 5 Use Cases https://codingsight.com/how-to-use-sql-server-t-sql-function-sum-5-use-cases/ Wed, 08 Sep 2021 07:43:58 +0000 http://codingsight.com/?p=16773 The T-SQL SUM function is one of the fundamental functions. Its purpose is to calculate the sum of all values in the specified column – note that it applies to numeric columns only. Below is the syntax of SQL SUM. ALL is a default value, not mandatory to pass. It allows for returning the sum …

The post How to Use SQL Server T-SQL Function SUM: 5 Use Cases appeared first on {coding}Sight.

]]>
SQL SELECT DISTINCT: Performance Best Practices https://codingsight.com/is-sql-distinct-good-for-removing-duplicates-in-results/ Mon, 06 Sep 2021 03:57:16 +0000 http://codingsight.com/?p=16716 Is SQL DISTINCT good (or bad) when you need to remove duplicates in results? Some say it’s good and add DISTINCT when duplicates appear. Some say it’s bad and suggest using GROUP BY without an aggregate function. Others say DISTINCT and GROUP BY are the same when you need to remove duplicates. This post will dive into the details …

The post SQL SELECT DISTINCT: Performance Best Practices appeared first on {coding}Sight.

]]>
Understanding SQL Server Security Function HAS_Permis_BY_Name and Its USE Cases https://codingsight.com/understanding-sql-server-security-function-has_permis_by_name-and-its-use-cases/ Mon, 30 Aug 2021 07:45:44 +0000 http://codingsight.com/?p=16429 There are multiple instances when we want to check the permission on a securable for a principal. Before going ahead, let’s see what principal, securables, and permissions are. According to Microsoft Documentation, Securables in SQL Server context are specific resources to which the SQL Server Database Engine authorization system controls access. They are divided into …

The post Understanding SQL Server Security Function HAS_Permis_BY_Name and Its USE Cases appeared first on {coding}Sight.

]]>
How to Use SQL SUM Function https://codingsight.com/how-to-use-sql-sum-function/ Fri, 27 Aug 2021 08:01:55 +0000 http://codingsight.com/?p=16411 SQL is a powerful and widely-used programming language for data storage, retrieval, and manipulation. One of the most commonly-used operators in SQL is SUM – a logical operation that produces the sum of all values in a column. This article will cover the basics of this operator usage in queries. Why Do You Need SQL …

The post How to Use SQL SUM Function appeared first on {coding}Sight.

]]>
User-Defined Functions in SQL Server https://codingsight.com/sql-server-user-defined-functions/ Mon, 16 Aug 2021 08:35:26 +0000 http://codingsight.com/?p=16097 User-defined functions in SQL Server (UDFs) are key objects that each developer should be aware of. Although they are very useful in many scenarios (WHERE clauses, computed columns, and check constraints), they still have some limitations and bad practices that can cause performance issues. Multi-statement UDFs might incur significant performance impacts, and this article will …

The post User-Defined Functions in SQL Server appeared first on {coding}Sight.

]]>
SQL Server ORDER BY Clause: The 5 Do’s and Don’ts to Sort Data Like a Pro https://codingsight.com/sql-order-by-the-5-dos-and-donts-to-sort-data-like-a-pro/ Thu, 12 Aug 2021 08:24:21 +0000 http://codingsight.com/?p=16061 Ugly. That’s what unsorted data looks like. We make data easy for the eyes by sorting them. And that’s what SQL ORDER BY is for. Use one or more columns or expressions as a basis to sort data. Then, add ASC or DESC to sort ascending or descending. ORDER BY syntax Learn the syntax of …

The post SQL Server ORDER BY Clause: The 5 Do’s and Don’ts to Sort Data Like a Pro appeared first on {coding}Sight.

]]>
GROUP BY in SQL Server: 3 Easy Examples to Group Results https://codingsight.com/sql-group-by-3-easy-tips-to-group-results-like-a-pro/ Tue, 10 Aug 2021 06:56:55 +0000 http://codingsight.com/?p=16014 Grouping is an important feature that helps organize and arrange data. There are a lot of ways to do it, and one of the most effective methods is the SQL GROUP BY clause. You can use SQL GROUP BY to divide rows in results into groups with an aggregate function. It sounds easy to sum, …

The post GROUP BY in SQL Server: 3 Easy Examples to Group Results appeared first on {coding}Sight.

]]>