Quantcast
Browsing all 162 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Is it possible to use Joins, Subqueries, and Unions in one Query?

A reader recently asked me to help them solve a problem combining data from multiple tables into a single result.  What was interesting was that the solution used the three ways to combine data that we...

View Article


Image may be NSFW.
Clik here to view.

SQL DISTINCT and TOP in Same Query

This article is inspired by a series of questions that one of my readers, Nan, recently sent me regarding DISTINCT, TOP, and ORDER BY. All the examples for this lesson are based on Microsoft SQL...

View Article


Image may be NSFW.
Clik here to view.

Foreign and Primary Key Differences (Visually Explained)

In this article we learn the difference between a primary key and a foreign key, and why both are important to maintaining a relational database structure. All the examples for this lesson are based on...

View Article

Image may be NSFW.
Clik here to view.

Using OFFSET and FETCH with the ORDER BY clause

In this article we explore the OFFSET and FETCH clauses.  OFFSET and FETCH are used in conjunction with the SELECT statement ORDER BY clause to provide a means to retrieve a range of records.  The...

View Article

Image may be NSFW.
Clik here to view.

What is the Difference between TOP and OFFSET & Fetch?

Both TOP and OFFSET & FETCH can be used to limit the number of rows returned.  OFFSET and FETCH can return similar results to top, but there are differences which may influence which method is best...

View Article


Image may be NSFW.
Clik here to view.

SQL CASE Statement – Simple and Searched Forms

The main purpose of a SQL CASE expression returns a value based on one or more conditional tests.  Use CASE expressions anywhere in a SQL statement an expression is allowed. Though a truly an...

View Article

Image may be NSFW.
Clik here to view.

Seven SQL Server Data Types you Must Know

In SQL the columns of a table are defined to store a specific kind of value such as numbers, dates, or text; these are called data types.  With over thirty types of SQL server data types to choose...

View Article

Image may be NSFW.
Clik here to view.

How can I find Duplicate Values in SQL Server?

In this article find out how to find duplicate values in a table or view using SQL.  We’ll go step by step through the process.  We’ll start with a simple problem, slowly build up the SQL, until we...

View Article


Image may be NSFW.
Clik here to view.

Converting Between Data Types with SQL Server Functions

SQL server uses data types to store a specific kind of value such as numbers, dates, or text in table columns and to use in functions, such as mathematical expressions. One issue with data types is...

View Article


Image may be NSFW.
Clik here to view.

Built-In Functions (SQL Server)

Built-In functions are used in SQL SELECT expressions to calculate values and manipulate data.  These functions can be used anywhere expressions are allowed.  Common uses of functions include to change...

View Article

Image may be NSFW.
Clik here to view.

Introduction to SQL Server’s Built-In Logical Functions

Logical functions provide a way to use logical conditions to display one of several values.  You can use logical functions to test a field’s value such as gender (M or F) and display another...

View Article

Image may be NSFW.
Clik here to view.

Introduction to SQL Server’s Mathematical Functions

Math Rocks! SQLServer includes many mathematical functions you can use to perform business and engineering calculations.  Many of these aren’t used in typical day-to-day operations; however, there are...

View Article

Image may be NSFW.
Clik here to view.

Subqueries versus Joins

Joins and subqueries are both be used to query data from different tables and may even share the same query plan, but there are many differences between them.  Knowing the differences and when to use...

View Article


Image may be NSFW.
Clik here to view.

Introduction to SQL Server’s Common String Functions

The built in SQL String functions make it possible for you to find and alter text values, such as VARCHAR and CHAR datatypes, in SQLServer.  Using these functions you can alter a text value such as...

View Article

Image may be NSFW.
Clik here to view.

Learn to use SQL Server Date Functions

SQL server’s date functions provide you a set of function that you can use to manipulate dates.  The function are used for a wide variety of operation such as adding weeks to a date, calculating the...

View Article


Image may be NSFW.
Clik here to view.

What Is the Difference Between a Join and a UNION?

Both Joins and UNIONS can be used to combine data from two or more tables.  Read this article to find out each command’s strengths and when to use them. To get the most of this and our other lessons be...

View Article

Image may be NSFW.
Clik here to view.

What is the Difference between Inner and Outer Joins?

Both inner and outer joins can be used to combine data from two or more tables; however, there are some key differences!  Read this article to find out each command’s strengths and when to use them. To...

View Article


Know when to use Cast versus Convert

In this article we’re going to explore the CAST and CONVERT functions to understand whether there are any significant differences worth knowing when we want to convert data from one type to another....

View Article

Image may be NSFW.
Clik here to view.

Common Table Expressions (Introduction to CTE’s)

Common Table Expressions or CTE’s for short are used within SQL Server to simplify complex joins and subqueries, and to provide a means to query hierarchical data such as an organizational chart.  In...

View Article

Image may be NSFW.
Clik here to view.

Non Recursive CTEs Explained and Why to Use Them

Introduction to Non Recursive CTEs In this article we explore non recursive CTEs (Common Table Expressions).  This is a broad class, and basically covers every form of CTEs except those that call...

View Article
Browsing all 162 articles
Browse latest View live