Create free account
User profile menu open
Open user profile menu
Payment & Billing
Payment & Billing
Create free account
6 Jun 2017
Using CASE with Data Modifying Statements
What happens when you combine CASE with SQL's data modifying statements? Find out in this article. The CASE expression is a very useful part of SQL and one that you'll employ frequently. We've already covered what the CASE expression does, how to format it, and how to use it in a SELECT statement in "Using CASE to Add Logic to a SELECT". Another article, "How to Sort Records with the ORDER BY Clause"
29 May 2017
Useful SQL Patterns: Matching Nulls by Masking Nulls
As you start coding in SQL, you will use some statements and techniques over and over again. We call these “SQL patterns”. This series will look at the most common SQL patterns and consider how to use them. In database development, SQL developers often find themselves returning to the same SQL statements. Learning about these now, early in your SQL journey, will help you work more efficiently. Today, in the first post of this series, we will consider the match by null SQL pattern related to SQL data matching.
18 May 2017
How to Sort Records with the ORDER BY Clause
Relational databases don't store records in alphabetical, numerical, ascending, or in any particular order. The only way to order records in the result set is to use the ORDER BY clause. You can use this clause to order rows by a column, a list of columns, or an expression. You can also order rows using the CASE expression. In this post, we'll take a look at the ORDER BY clause – how to write it, how it works, and what it does.
15 May 2017
Oracle Top-N Queries for Absolute Beginners
It's common to run a query using only part of a dataset – for example, the top 100 salespeople in a company. In this article, we'll see how to use Oracle's Top-N query method to query just these rows. Top-N queries retrieve a defined number of rows (top or bottom) from a result set. In other words, they find the best or worst of something – the ten best selling cars in a certain region, the five most popular routers, the 20 worst-performing stores, etc.
8 May 2017
SQL Statistical Analysis Part 2: Calculating Centers of Distribution
My previous article explained how to calculate frequencies using T-SQL queries. Frequencies are used to analyze the distribution of discrete variables. Today, we’ll continue learning about statistics and SQL. In particular, we’ll focus on calculating centers of distribution. We’ll learn e.g. how to calculate the SQL median, what functions to use to calculate the SQL mode, and how to calculate various types of mean in SQL (geometric mean, harmonic mean and, of course, arithmetic mean).
7 May 2017
Using CASE to Add Logic to a SELECT
As you write an SQL query, you may need to get values from multiple columns and change values from one form to another. The simple way to achieve this goal is to add a CASE expression to your SELECT statement. In this article, we'll introduce you to the syntax, formats, and uses of the CASE expression. The CASE expression is a conditional expression: it evaluates data and returns a result.
4 May 2017
Book Review: “Learn SQL the Hard Way” by Zed A. Shaw
“Learn SQL the Hard Way” by Zed A. Shaw is a great ebook for those who want to learn SQL essentials. At $19.99 USD, it may seem a bit expensive for an ebook, but you’re getting a DRM-free PDF, plus a whole bunch of explanatory videos and additional files. Who should read “Learn SQL the Hard Way”? Anyone interested in SQL basics – modifying databases or selecting information. Make no mistake about it: this book focuses heavily on the practical side of database language.
27 Apr 2017
NULL Values and the GROUP BY Clause
We've already covered how to use the GROUP BY clause and some aggregation functions like SUM(), AVG(), MAX(), MIN(), COUNT(). In this article, we will explain how the GROUP BY clause works when NULL values are involved. We will also explain about using NULLs with the ORDER BY clause. The best way to master GROUP BY and NULL in SQL is through practice. I recommend the SQL Practice track at LearnSQL.
26 Apr 2017
LearnSQL.com Review: “SQL Cookbook” by Anthony Molinaro
Recipes that make querying easy, even for the novice. In today’s information age, we have at our fingertips almost an overabundance of teaching and information on any and every subject. In the midst of this glut of information, it can be hard to decide which is the best source for our needs. But, fear not; we are here to assist you as you navigate through decisions about books on SQL topics!
20 Apr 2017
How to Use LIKE in SQL: SQL Pattern Matching
SQL pattern matching is a very important and useful ability. In this article, we look at how you can perform it using LIKE in SQL. SQL Pattern matching is a very simple concept. It allows you to search strings and substrings and find certain characters or groups of characters. Apart from SQL, this operation can be performed in many other programming languages. In this article, we’ll examine how you can use LIKE in SQL to search substrings.