SQL Essentials stairway series helps readers understand the most common database language SQL uses for data munging and data wrangling. SQL Essentials articles is a collection of SQL standards and best practices and help you take you in step closer to learn database query.
Read more »T-SQL
Learn SQL: Dynamic SQL
March 3, 2021Dynamic SQL is a programming technique you can use to build SQL statements as textual strings and execute them later. This technique could prove to be useful in some cases and therefore it’s good to know we have it as an option. In today’s article, we’ll show how to create and execute dynamic SQL statements.
Read more »SUBSTRING, PATINDEX and CHARINDEX string functions in SQL queries
March 1, 2021In this article, we will explore SUBSTRING, PATINDEX and CHARINDEX string functions for SQL queries.
Read more »Getting started with SQL Programming
February 3, 2021Learning SQL programming is valuable for our career and might help to increase our incomes but most importantly it will be the best investment you will make for yourself. However, beginners don’t know the exact starting point to begin learning the SQL language. Learning SQL depends entirely on your effort and desire, and other things are just details. This article will give some tips on how to learn SQL without going into technical details so that so you can get started in learning SQL right now.
Read more »SQL SELECT TOP statement overview and examples
January 25, 2021In this article, we will learn how to use SQL SELECT TOP queries and we will also reinforce this learning using examples.
Read more »T-SQL scripts to update statistics based on the row modification
December 24, 2020In this article, we are going to learn how we can develop a T-SQL script to update statistics of tables based on the row modification. It is always a challenging task to perform maintenance on a table that has billions of rows. During the early years of my professional career, I was assigned a project and one of our clients had performance issues. The initial analysis showed that due to frequent data modifications, a specific table’s statistics become outdated.
Read more »An Overview of User-defined SQL Server Types
November 3, 2020In this article, we will explore User-defined SQL Server Types and their usage.
Read more »Learn SQL: SQL Injection
November 2, 2020SQL Injection is a well-known technique used to attack SQL-based applications. In this article, we’ll focus on examples showing how you could exploit database vulnerabilities using this technique, while in the next article we’ll talk about ways how you can protect your application from such attacks.
Read more »T-SQL scripts to generate database health reports
October 21, 2020In this article, I am going to show how we can automate a database daily health report using T-SQL scripts. For a senior database administrator, it is always important to review the health of the database server. When a DBA manages many database servers, it becomes difficult to visit every server and review the status of databases, SQL jobs, and backups. To ease the monitoring, I have developed a T-SQL script that populates the following information:
Read more »Learn SQL: Non-Equi Joins in SQL Server
September 29, 2020Non-Equi join in SQL Server sounds like something abstract (and fancy), but it’s not so abstract (and fancy) at all. The same stands for equi joins. After reading this article, I hope you’ll agree on that with me. Today’ I’ll try to explain what they are and when you should use them. So, let’s start.
Read more »Learn SQL: SQL-Related Jobs
September 1, 2020In today’s article, we’ll take a look at 4 common SQL-related jobs and roles and explain what kind of tasks you could expect at each of these roles and what types of queries you’ll possibly use to solve these tasks. If you’re already in any of these roles, you’re probably familiar with this, but if you’re new to the world of SQL, you could find this very useful to decide in which way you want your career to develop.
Read more »T-SQL scripts to copy or remove files from a directory in SQL Server 2019
August 21, 2020Sometimes database professionals need to perform specific tasks at the operating system level. These tasks can be like copying, moving, deleting files and folders. A use case of these tasks might be removing the old backup files or copying backup files to a specific directory after a particular time. In SQL Server, we can use xp_cmdshell extended stored procedure to execute commands directly in the Windows command prompt(CMD). You need a sysadmin role or proxy account configured to use this extended procedure. We can also use the SSIS package for the file transfer, but it also requires you to build a package with the relevant tasks.
Read more »Add or remove a node from SQL Server Always On Availability Groups using T-SQL scripts
July 29, 2020This is the 7th article in the series of SQL Server Always on Availability Groups.
Read more »Diving deep with complex Data Structures
July 29, 2020In my previous article, Understanding common Data Structures, I have mentioned the most commonly used data structures in software programming. In this article, let us get into some more details about the other data structures that are a bit complex than the ones already discussed but also used quite often while designing software applications. Here, we will look into the following data structures.
Read more »Learn SQL: Naming Conventions
July 28, 2020A naming convention is a set of unwritten rules you should use if you want to increase the readability of the whole data model. Today, I’ll try to explain how you should formulate your naming convention and, maybe even more important, why should you do it and what is the overall benefit from using it.
Read more »Understanding the SQL MERGE statement
July 27, 2020In this article, I am going to give a detailed explanation of how to use the SQL MERGE statement in SQL Server. The MERGE statement in SQL is a very popular clause that can handle inserts, updates, and deletes all in a single transaction without having to write separate logic for each of these. You can specify conditions on which you expect the MERGE statement to insert, update, or delete, etc.
Read more »An introduction to SQL tables
July 17, 2020In this article, we will learn the concept of SQL tables and then work on how we can create tables with different techniques in SQL Server.
Read more »Understanding common Data Structures
July 15, 2020In this article, I am going to walk you through the concepts of the common Data Structures that every student, colleague working with computers should be aware of. Data Structure forms an integral part of any system or database design. It is a very interesting and intuitive concept that you can apply anywhere. Through this article, I aim to introduce the beginners to the concepts of Data Structures and brush up the same for colleagues who have already been associated with the industry for years. This will also help you understand some database concepts more easily once you have a grasp over these concepts.
Read more »SQL UPDATE syntax explained
July 10, 2020This article will get you familiar with the SQL UPDATE syntax and demonstrate how this statement can be used for modifying data using T-SQL. Data modification side of DML language in T-SQL includes three statements used for modifying data in SQL Server and those are: INSERT, UPDATE, and DELETE. The focus here will be on the UPDATE statement explicitly.
Read more »Learn SQL: SQL Best Practices for Deleting and Updating data
July 7, 2020Deleting and updating data is very common, but if performed without taking care, which could lead to inconsistent data or data loss. Today, we’ll talk about SQL best practices when performing deletes and updates. We’re not talking about regular/expected changes, but rather about manual changes which will be required from time to time. So, let’s start.
Read more »Explore the SQL query Hint OPTION (FAST N)
July 2, 2020In this article, we will introduce SQL queries hint and will analyze the OPTION(Fast ‘N’) hint in detail.
Read more »SQL SUBSTRING function and its performance tips
June 30, 2020In this article, we will briefly explain the SUBSTRING function and then focus on performance tips about it.
Read more »Execute a SQL Server procedure inside a function
June 23, 2020In this article, we will ensure that the execution of the SQL Server procedure inside the function is possible. A common understanding of the database developer is that the procedure cannot be utilized or executed inside a user-defined function because the user-defined function does not allow performing DML operation with the table. The procedure is allowed to play with the database and its property, whether a user-defined function isn’t. That should be the essential reason behind allowing the execution of a SQL Server procedure inside the function.
Read more »Learn SQL: SQL Server Cursors
June 22, 2020SQL Server cursors are one common topic on the Internet. You’ll find different opinions when to use them and when not to do it. Today, we’ll also talk about them and answer the question when (not) to use them.
Read more »An overview of Logon triggers in SQL Server
June 19, 2020This article gives you an overview of Logon triggers in SQL Server and its usage to control SQL Server authentication.
Read more »