Everything You Need to Know About SQL CTE in One Spot

Total: 1 Average: 5

The first time Karl heard of SQL Server CTE was when he was looking for something to make his SQL code easier for the eye. It’s kind of a headache when you look at it. Anton, his concerned colleague, asked him about CTE. Karl thought Anton was referring to his headache. Maybe he heard it all wrong, so he answered, “Of course not.” The funny thing is, he was referring to Chronic Traumatic Encephalopathy, also a CTE – a neurodegenerative disease caused by repeated head injuries. But based on Karl’s response, Anton knew for sure that his colleague was clueless about what he was saying.

What a crazy way to introduce CTEs! So, before you get into the same boat, let’s clarify, what is SQL CTE or Common Table Expressions in the SQL world?

You can read the basics here. Meanwhile, we’ll learn a bit more about what happened in this unusual story.

Read More

Add Columns to an Existing Table in SQL Server Database

Total: 1 Average: 5

Introduction

A table is a two-dimensional logical structure and the fundamental means of storing data in relational database management systems. Its ‘row and column’ format is very much like the organization of the spreadsheet. 

Each new record introduced to a table is a row (also called a record or tuple), while rows are grouped into a finite set of columns (also called fields or attributes). Each column has a name and data type, and it serves as a reference for displaying result sets when querying data from relational database systems.

In this article, we explore the current options letting us add new columns to an existing table in SQL Server database. The use case may arise on many occasions. Particularly, it happens when there are updates for an application, and they demand adding new columns.

Read More

Handling the NULL Values Effectively with the SQL COALESCE Function for Beginners

Total: 1 Average: 5

This article aims to help beginners understand the basics of the T-SQL COALESCE function and its application for handling NULL values. Additionally, the readers will get hands-on experience by implementing some simple examples of this function.

We’ll also highlight the importance of T-SQL functions in resolving database analytical problems.

Read More

Using CASE Expressions in SQL Server

Total: 1 Average: 5

Introduction

CASE Expressions in SQL Server are used for the column values substitution to present the result sets in a particular fashion or simple queries. Use cases for such commands are various.

For instance, there is a column containing the department code, but you wish to display the department’s name rather than the code. You could achieve it by doing a JOIN with another table containing the department details. However, let’s assume you want to keep the query relatively simple. Another use case would be returning specific values for the computed values set. Computed columns would not fit if the sets of conditions to specify are not the same.

Read More

Data Visualization in Microsoft Power BI

Total: 1 Average: 5

Contents

  1. Introduction.
  2. How to create a table.
  3. How to create a Power BI pie chart.
  4. Creating a line chart in Power BI.
  5. Report creation.
  6. Conclusion.

Introduction

The final article will take us through Power BI Visualizations and how to create them using the data sets created previously in these series. The walkthrough will cover 3 basic Visualizations: Table, Pie Chart, and Line Chart. These will then combine to create a basic report/dashboard within Power BI.

Read More