Emil Drkusic

Emil Drkusic
Latest posts by Emil Drkusic (see all)
the data model

Learn SQL: Dynamic SQL

March 3, 2021 by

Dynamic 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 »
the data model

Learn SQL: SQL Injection

November 2, 2020 by

SQL 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 »
joining two tables using > operator

Learn SQL: Non-Equi Joins in SQL Server

September 29, 2020 by

Non-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 »
SQL-related jobs - the data model

Learn SQL: SQL-Related Jobs

September 1, 2020 by

In 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 »
Naming convention - the data model

Learn SQL: Naming Conventions

July 28, 2020 by

A 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 »
SQL Server PIVOT TABLE - the data model we'll use

Learn SQL: SQL Server Pivot Tables

May 11, 2020 by

In the previous few articles in this series, we’ve set the foundations on how to create a report. We’ll take one step further and see how to use the SQL Server PIVOT table operator. We’ll start from the simple query and slowly progress towards dynamic SQL and PIVOT. Let’s start.

Read more »
SQL Server date and time functions - the data model we'll use in the article

Learn SQL: SQL Server date and time functions

April 21, 2020 by

So far, we haven’t talked about SQL Server date and time functions. Today we’ll change that. We’ll take a close look at the ones most frequently used and mention all other date and time functions as well. This will be also the first step to create reports, including date and time functions. We’ll do that in upcoming articles in this series.

Read more »
SQL Examples - the data model we'll use in the article

Learn SQL: SQL Query examples

March 31, 2020 by

In the previous article we’ve practiced SQL, and today, we’ll continue with a few more SQL examples. The goal of this article is to start with a fairly simple query and move towards more complex queries. We’ll examine queries you could need at the job interview, but also some you would need in real-life situations. So, buckle up, we’re taking off!

Read more »
The data model we'll use to explain user-defined functions

Learn SQL: User-Defined Functions

February 25, 2020 by

You can create several user-defined objects in a database. One of these is definitely user-defined functions. When used as intended, they are a very powerful tool in databases. In today’s article, we’ll see how to create, change and remove them from the database, as well as how to use them. So, let’s dive into the matter.

Read more »

Learn SQL: How to Write a Complex SELECT Query

February 4, 2020 by

In my career, I’ve heard many times, things like “How to write a complex SELECT query?”, “Where to start from?” or “This query looks so complex. How you’ve learned to write such complex queries?”. While I would like to think of myself as of a brilliant mind or genius or add something like “query magician” to my social network profiles, well, writing complex SQL wouldn’t be the only thing required to do that. Therefore, in this article, I’ll try to cover the “magic” behind writing complex SELECT statements.

Read more »
aggregate functions - the data model we'll use

Learn SQL: Aggregate Functions

January 28, 2020 by

SQL has many cool features and aggregate functions are definitely one of these features, actually functions. While they are not specific to SQL, they are used often. They are part of the SELECT statement, and this allows us to have all benefits of SELECT (joining tables, filtering only rows and columns we need), combined with the power of these functions.

Read more »