filmov
tv
SQL Basics - Querying (learn how to write queries in 30 minutes)

Показать описание
Another video brought to you by BeardedDev, bringing you tutorials on Data Engineering, Business Intelligence, T-SQL Programming and Data Analysis.
Prerequisites
Have you ever thought "how do I get started with SQL?", "how do I find out if SQL is for me?" then this video aims to answer those questions, it will allow you to start writing SQL queries straight away.
In this video we cover how to write SELECT statements, how to filter data using a WHERE clause, how to return only unique values and how different data types work in SQL Server.
After just 30 minutes you will become competent in writing SQL queries and I encourage you to try out other queries on your own.
This tutorial is going to be part of a short series that aims to get you up and running straight away, writing queries and potentially hungry to learn more.
Whether you are a data analyst look to develop your skillset or a front end developer curious about how databases work or a recent graduate then I'm sure you will find something here that will help.
If you have any difficulties setting up the environment of would like me to produce a tutorial then please let me know in the comments below.
Code Samples - this is not complete but you can copy and paste and change as necessary
Replace any words with [] with symbols, cannot add angle brackets in description
-- return all columns
SELECT
*
FROM Sales.SalesOrderHeader;
-- return specific columns
SELECT
SalesOrderID,
OrderDate,
SalesOrderNumber,
CustomerID,
TotalDue
FROM Sales.SalesOrderHeader;
-- filter by customerid
SELECT
SalesOrderID,
OrderDate,
SalesOrderNumber,
CustomerID,
TotalDue
FROM Sales.SalesOrderHeader
WHERE CustomerID = 11091;
-- filter by totaldue greater than equal to
SELECT
SalesOrderID,
OrderDate,
SalesOrderNumber,
CustomerID,
TotalDue
FROM Sales.SalesOrderHeader
WHERE TotalDue [greater than]= 1000;
-- filter by orderdate less than
SELECT
SalesOrderID,
OrderDate,
SalesOrderNumber,
CustomerID,
TotalDue
FROM Sales.SalesOrderHeader
WHERE OrderDate [less than] '20140101';
-- multiple filters
SELECT
SalesOrderID,
OrderDate,
SalesOrderNumber,
CustomerID,
TotalDue
FROM Sales.SalesOrderHeader
WHERE CustomerID = 11091
AND TotalDue [greater than]= 1000;
-- return unique customerid
SELECT DISTINCT
CustomerID
FROM Sales.SalesOrderHeader;
Prerequisites
Have you ever thought "how do I get started with SQL?", "how do I find out if SQL is for me?" then this video aims to answer those questions, it will allow you to start writing SQL queries straight away.
In this video we cover how to write SELECT statements, how to filter data using a WHERE clause, how to return only unique values and how different data types work in SQL Server.
After just 30 minutes you will become competent in writing SQL queries and I encourage you to try out other queries on your own.
This tutorial is going to be part of a short series that aims to get you up and running straight away, writing queries and potentially hungry to learn more.
Whether you are a data analyst look to develop your skillset or a front end developer curious about how databases work or a recent graduate then I'm sure you will find something here that will help.
If you have any difficulties setting up the environment of would like me to produce a tutorial then please let me know in the comments below.
Code Samples - this is not complete but you can copy and paste and change as necessary
Replace any words with [] with symbols, cannot add angle brackets in description
-- return all columns
SELECT
*
FROM Sales.SalesOrderHeader;
-- return specific columns
SELECT
SalesOrderID,
OrderDate,
SalesOrderNumber,
CustomerID,
TotalDue
FROM Sales.SalesOrderHeader;
-- filter by customerid
SELECT
SalesOrderID,
OrderDate,
SalesOrderNumber,
CustomerID,
TotalDue
FROM Sales.SalesOrderHeader
WHERE CustomerID = 11091;
-- filter by totaldue greater than equal to
SELECT
SalesOrderID,
OrderDate,
SalesOrderNumber,
CustomerID,
TotalDue
FROM Sales.SalesOrderHeader
WHERE TotalDue [greater than]= 1000;
-- filter by orderdate less than
SELECT
SalesOrderID,
OrderDate,
SalesOrderNumber,
CustomerID,
TotalDue
FROM Sales.SalesOrderHeader
WHERE OrderDate [less than] '20140101';
-- multiple filters
SELECT
SalesOrderID,
OrderDate,
SalesOrderNumber,
CustomerID,
TotalDue
FROM Sales.SalesOrderHeader
WHERE CustomerID = 11091
AND TotalDue [greater than]= 1000;
-- return unique customerid
SELECT DISTINCT
CustomerID
FROM Sales.SalesOrderHeader;
Комментарии