filmov
tv
SQL Tutorial - CASE Statements

Показать описание
Another video brought to you by BeardedDev, bringing you tutorials on Business Intelligence, SQL Programming and Data Analysis.
In this video I talk about how to use CASE statements in SQL Server.
T-SQL Querying
T-SQL Fundamentals
Microsoft SQL Server 2012 High-Performance T-SQL Using Window Functions
CASE Statements were introduced to SQL Server in 2008. They are used to evaluate conditions and return a result based on those conditions. CASE Statements can be used in SELECT, UPDATE, DELETE, WHERE, HAVING.
In this CASE Tutorial we look at a common use of CASE statements within SELECT and also the benefit and common downfalls when writing CASE queries.
CASE Statement Syntax:
CASE WHEN [condition] THEN [result] END
SQL Queries in this video:
SELECT
CustomerId
, FirstName
, MiddleName
, LastName
, CASE
WHEN CustomerId = 5995 THEN 'Unknown'
WHEN Gender = 'M' THEN 'Male'
WHEN Gender = 'F' THEN 'Female'
ELSE 'Unknown'
END AS Gender
, DOB
FROM dbo.CustomersSample
Please feel free to post comments.
In this video I talk about how to use CASE statements in SQL Server.
T-SQL Querying
T-SQL Fundamentals
Microsoft SQL Server 2012 High-Performance T-SQL Using Window Functions
CASE Statements were introduced to SQL Server in 2008. They are used to evaluate conditions and return a result based on those conditions. CASE Statements can be used in SELECT, UPDATE, DELETE, WHERE, HAVING.
In this CASE Tutorial we look at a common use of CASE statements within SELECT and also the benefit and common downfalls when writing CASE queries.
CASE Statement Syntax:
CASE WHEN [condition] THEN [result] END
SQL Queries in this video:
SELECT
CustomerId
, FirstName
, MiddleName
, LastName
, CASE
WHEN CustomerId = 5995 THEN 'Unknown'
WHEN Gender = 'M' THEN 'Male'
WHEN Gender = 'F' THEN 'Female'
ELSE 'Unknown'
END AS Gender
, DOB
FROM dbo.CustomersSample
Please feel free to post comments.
Комментарии