t-sql queries Archives - {coding}Sight https://codingsight.com/tag/t-sql-queries/ Blog for SQL Server DBAs and Developers Mon, 17 Jul 2023 08:20:35 +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 t-sql queries Archives - {coding}Sight https://codingsight.com/tag/t-sql-queries/ 32 32 Clustered and Non Clustered Index: 7 Top Points Explained https://codingsight.com/clustered-and-non-clustered-index-7-top-points-explained/ https://codingsight.com/clustered-and-non-clustered-index-7-top-points-explained/#comments Tue, 18 May 2021 10:46:14 +0000 http://codingsight.com/?p=13911 Indexes are speed-boosters in SQL databases. They can be clustered or non-clustered. But what does it mean and where should you apply each? I know this feeling. I’ve been there. First-timers are often confused about which index to use on which columns. However, even experts need to think this issue through before making a decision, and …

The post Clustered and Non Clustered Index: 7 Top Points Explained appeared first on {coding}Sight.

]]>
https://codingsight.com/clustered-and-non-clustered-index-7-top-points-explained/feed/ 1
SQL Basic Commands: How to Write Simple Queries with Examples https://codingsight.com/how-to-write-simple-sql-queries-from-blank-database/ Thu, 25 Feb 2021 08:30:49 +0000 http://codingsight.com/?p=12213 This article explains writing simple SQL queries from the most basic ones and gradually improving the script to solve some mathematical and date-related problems. Additionally, we are going to clarify the concepts surrounding SQL queries. Although this article is primarily for beginners, it contains hints that will be helpful for any experience level. What is …

The post SQL Basic Commands: How to Write Simple Queries with Examples appeared first on {coding}Sight.

]]>
Configure SQL Jobs in SQL Server using T-SQL https://codingsight.com/configure-sql-jobs-in-sql-server-using-t-sql/ Mon, 19 Oct 2020 08:44:24 +0000 https://codingsight.com/?p=10179 SQL Server Agent is a component used for the database tasks automation. For instance, we need to perform Index maintenance on Production servers during the non-business hours only. So, we create a SQL Server job of running index maintenance and schedule it for “off” hours. When we install SQL Server, the SQL Server Agent service …

The post Configure SQL Jobs in SQL Server using T-SQL appeared first on {coding}Sight.

]]>
Welcome Back the T-SQL Debugger with SQL Complete – SQL Debugger https://codingsight.com/welcome-back-the-t-sql-debugger-with-sql-complete/ Mon, 27 Jul 2020 09:47:35 +0000 https://codingsight.com/?p=9507 When you develop large chunks of T-SQL code with the help of the SQL Server Management Studio tool, it is essential to test the “Live” behavior of your code by making sure that each small piece of code works fine and being able to allocate any error message that may cause a failure within that …

The post Welcome Back the T-SQL Debugger with SQL Complete – SQL Debugger appeared first on {coding}Sight.

]]>
Learn Basic Data Analysis with SQL Window Functions https://codingsight.com/learn-basic-data-analysis-with-sql-window-functions/ Wed, 12 Jun 2019 21:50:39 +0000 https://codingsight.com/?p=7155 This article is about T-SQL (Transact-SQL) Window functions and their basic use in day-to-day data analysis tasks. There are many alternatives to T-SQL when it comes to data analysis. However, when improvements over time and introduction of Window functions are considered, T-SQL is capable of performing data analysis on a basic level and, in some …

The post Learn Basic Data Analysis with SQL Window Functions appeared first on {coding}Sight.

]]>
How to Write T-SQL Queries Like a Pro https://codingsight.com/how-to-write-t-sql-queries-like-a-pro/ Thu, 10 Jan 2019 12:36:07 +0000 https://codingsight.com/?p=5984 The skills of writing different types of SQL Server queries require you to have good knowledge in the SQL Server T-SQL language. T-SQL stands for Transact Structure Query Language, which is a database procedural programming language that is extending the SQL language for Microsoft SQL Server RDBMS product. The best and direct way of learning …

The post How to Write T-SQL Queries Like a Pro appeared first on {coding}Sight.

]]>
Calculating Running Total with OVER Clause and PARTITION BY Clause in SQL Server https://codingsight.com/calculating-running-total-with-over-clause-and-partition-by-clause-in-sql-server/ https://codingsight.com/calculating-running-total-with-over-clause-and-partition-by-clause-in-sql-server/#comments Fri, 16 Mar 2018 10:47:42 +0000 http://codingsight.com/?p=3548 You often come across scenarios where you have to calculate a running total of a quantity. A running total refers to the sum of values in all cells of a column that precedes the next cell in that particular column. Let’s take a look at an example to make this clearer. As you can see, …

The post Calculating Running Total with OVER Clause and PARTITION BY Clause in SQL Server appeared first on {coding}Sight.

]]>
https://codingsight.com/calculating-running-total-with-over-clause-and-partition-by-clause-in-sql-server/feed/ 1
T-SQL BEST Practices https://codingsight.com/t-sql-best-practices/ https://codingsight.com/t-sql-best-practices/#comments Tue, 20 Feb 2018 18:44:36 +0000 http://codingsight.com/?p=3368 In this article, we will discover some best practices of T-SQL queries. Badly written queries can cause performance and I/O problems. For this reason, we should pay attention to keep some rules in our mind when writing T-SQL queries. Don’t use “SELECT * “ in queries When we write a query, we  need to  select …

The post T-SQL BEST Practices appeared first on {coding}Sight.

]]>
https://codingsight.com/t-sql-best-practices/feed/ 3
Grouping Data using the OVER and PARTITION BY Functions https://codingsight.com/grouping-data-using-the-over-and-partition-by-functions/ https://codingsight.com/grouping-data-using-the-over-and-partition-by-functions/#comments Fri, 16 Feb 2018 13:40:24 +0000 http://codingsight.com/?p=3352 The OVER and PARTITION BY functions are both functions used to portion a results set according to specified criteria. This article explains how these two functions can be used in conjunction to retrieve partitioned data in very specific ways. Preparing Some Sample Data To execute our sample queries, let’s first create a database named “studentdb”. …

The post Grouping Data using the OVER and PARTITION BY Functions appeared first on {coding}Sight.

]]>
https://codingsight.com/grouping-data-using-the-over-and-partition-by-functions/feed/ 1
SQL Server Trigger: Understanding and Alternatives https://codingsight.com/sql-server-triggers-understanding-alternatives/ Tue, 30 Jan 2018 13:59:43 +0000 http://codingsight.com/?p=3235 The SQL Server trigger is a special type of stored procedures that is automatically executed when an event occurs in a specific database server. SQL Server provides us with two main types of triggers: the DML Triggers and the DDL triggers. The DDL triggers will be fired in response to different Data Definition Language (DDL) …

The post SQL Server Trigger: Understanding and Alternatives appeared first on {coding}Sight.

]]>