7 Oct 2021 Tihomir Babic How to Use CASE in ORDER BY in SQL This article will show you how and when to use CASE in an ORDER BY clause. Have you ever used a CASE statement? I’m sure you have, at least in a SELECT statement. But have you ever used it in an ORDER BY clause? No? You will, once I show you how! Don’t worry if you’ve never used a CASE statement. I’ll show and explain it to you with a short example. Read more 28 Sep 2021 Tihomir Babic Difference Between ROWS and RANGE in Window Functions Are you familiar with ROWS and RANGE window functions but not sure how they are different? This article makes those differences clear. In using SQL window functions, you’ve probably come across ROWS and RANGE clauses. If you haven’t, they are both parts of the Window Functions course. If you have, it’s quite likely you have been left confused why there are two keywords for the same function. Well, they are not the same! Read more 22 Sep 2021 Tihomir Babic The 7 Best Articles about the SQL Recursive Query Do you want to learn about recursive queries but don’t know where to start? Here’s our selection of seven articles that should help you with diving into the recursive queries world. I won’t lie to you. Learning and understanding recursive queries can be difficult. But difficult things are usually worth trying. And by learning recursive queries, you’re making sure you know how to work with this very powerful tool. Read more 10 Sep 2021 Tihomir Babic Frequently Asked Questions About SQL Ten SQL questions that you should be able to answer if you’re applying for an SQL job. SQL is a vast topic and a source of endless questions from its users. However, some questions are asked more frequently – usually about concepts that most SQL users will need to know. It’s not surprising that interviewers tend to ask these same questions to SQL job candidates. Either way, knowing these questions is a first step to learning SQL. Read more 26 Aug 2021 Tihomir Babic 3 Real-Life Examples for SQL Common Table Expressions We answer three SQL business questions using CTEs. There are business problems that are often solved in a very roundabout way. While they might get you the correct result, there’s usually a more elegant way to write a solution. Enter the CTEs! They are extremely helpful when it comes to getting a more direct and elegant solution. I’ll show you three business situations where CTEs can be very helpful. You’ll get an idea of when CTEs can be useful. Read more 11 Aug 2021 Tihomir Babic How to Find the Nth-Highest Salary by Department with SQL Learn how to find the nth-highest salary in SQL, and you’ll learn how to get the nth value in any data. In this article, I’ll focus on one problem and give you several solutions to that problem. The problem is stated in the title already: find the nth-highest salary by department using SQL. This may sound too specific. But by learning how to solve this, you’ll be able to find the nth value in any data, not just salaries. Read more 20 Jul 2021 Tihomir Babic How to Keep Unmatched Rows When You Join two Tables in SQL Learn how to use JOIN to keep both matched and unmatched rows when you join two tables. Joining two or more tables is a skill you need a lot if you’re working with databases. To review and practice your SQL joining skills, I recommend the interactive SQL JOINs course. It contains over 90 exercises and sections on different joining challenges. If you often join tables in SQL, you’ve probably noticed not all data from one table corresponds to data from another table all the time. Read more 6 Jul 2021 Tihomir Babic RANGE Clause in Window Functions: 5 Practical Examples What is a RANGE clause in SQL window functions? Five practical examples will show you how and when to use it. The RANGE clause is used quite rarely in SQL window functions. I don't know why; maybe people are not used to it. This is a shame, because it's far from a pointless clause; it can be very useful, and I'll show you that in five examples. To learn how window functions work, what functions there are, and how to apply them to real-world problems, it’s best to take the Window Functions course. Read more 16 Jun 2021 Tihomir Babic Business SQL: How to Calculate Revenue Growth in SQL Can you use SQL in business? Of course you can! For example, you can calculate revenue growth in SQL – here’s how. As someone who works with data, you already know that SQL is the most used tool in data analysis. But how is SQL helpful in business use? Well, the answer is obvious: analyze business data using SQL! However, there are some specifics with business data that can be tricky if you’re not used to it. Read more 10 Jun 2021 Tihomir Babic How to Draw Pictures with Recursive SQL Queries Did you know that SQL can be used for fun? You can even ‘draw’ in SQL using recursive queries! Find out how in this article. As an SQL user, you already know this language is great for data analysis and data manipulation in general. This is something people get very serious about. But you can also have fun with it by drawing ASCII-art pictures using the SQL code. To do that, you have to know how recursive SQL queries work. Read more «« « 1 2 3 … 5 6 7 … 9 » »»