Problem You want to round up to the nearest integer. Background Suppose
Recently a student asked me how he could calculate a Moving Median. It’s not as easy as you think, as SQL doesn’t
Problem You need use SQL to calculate the Median of a result from SQL Server. Background Suppose you need to calculate the
Problem You need to avoid SQL divide by zero errors. Suppose you need to calculate velocity using the formula v = s
Problem Given a date, you want to subtract 30 days in the past using SQL. Said another way, get the date thirty
Problem You need to figure out the week number from date, assuming Monday is the first day of the week using PostgreSQL,
Problem You want to replace all occurrences of a substring with a new substring using PostgreSQL, MySQL, or SQL Server. Background The
In this article we are going to design and create a sample relational database you can use with MySql, PostgreSQL or Microsoft
You can use the SQL CREATE TABLE command to create a new table in the database. When you create a table you
Problem You want to use today’s date in your SQL query, but don’t want to type it in each day. Solution You
How to Get a Date 30 Days into the Future. Problem You want to calculate a date 30 days into the Future
In this article I’ll show you how to use STRING_SPLIT() to join two tables. I call this the impossible join. I’ve come
Sooner or later, you want to know when a column contains in SQL another value. In this article we’ll go over several
What is a Database Trigger? A SQL trigger is special stored procedure that is run when specific actions occur within a database.
Use SQL HAVING to filter summary results from a GROUP BY. It specifies the search condition for the group or aggregate. SQL
Use the SQL GROUP BY Clause is to consolidate like values into a single row. The group is a set of columns. The group
The SQL SUM function returns the total value within a table or group. In its simplest use, SUM() totals a column for all results and returns a
In this article learn when to use WHERE and HAVING. Both perform similar functions, but for different purposes! All the examples for
In this article you’ll learn to use the LIKE operator in your SQL. In most situations you’ll find yourself using LIKE within
In this video we’ll walk you though how to use the LIKE clause. We’ll show you how to you can perform
In today’s lesson, you’re going to learn how to filter query results using the SQL WHERE clause. This clause is important as
The SQL ORDER BY clause is used to sort your query result in ascending or descending order. Once you have written a
Both TOP and OFFSET & FETCH can be used to limit the number of rows returned. OFFSET and FETCH can return similar
In this article we explore the OFFSET and FETCH clauses. OFFSET and FETCH are used in conjunction with the SELECT statement ORDER
Some times you just need to use SQL TOP to reduce the number of rows shown in your result. This is handy
You will learn how to query Microsoft SQL Server using the SQL SELECT statement in this series of lessons. Once you have