Intermediate SQL Tutorial | Unions | Union Operator

preview_player
Показать описание

In today's Intermediate SQL lesson we walk through Unions.

All Topics Covered: Joins, Unions, Case Statements, Updating/Deleting Data, Partition By, Data Types, Aliasing, Views, Having Clause, GetDate(), Primary vs Foreign Key

____________________________________________

SUBSCRIBE!
Do you want to become a Data Analyst? That's what this channel is all about! My goal is to help you learn everything you need in order to start your career or even switch your career into Data Analytics. Be sure to subscribe to not miss out on any content!
____________________________________________

RESOURCES:

Coursera Courses:

Udemy Courses:

*Please note I may earn a small commission for any purchase through these links - Thanks for supporting the channel!*
____________________________________________

Websites:

____________________________________________

*All opinions or statements in this video are my own and do not reflect the opinion of the company I work for or have ever worked for*
Рекомендации по теме
Комментарии
Автор

I see you inserted new rows in EmployeeDemographics and created WareHouseEmployeeDemographics, but you did not put the code on Git. I will let it here, hope it helps:

Table 1 Insert:
Insert into EmployeeDemographics VALUES
(1011, 'Ryan', 'Howard', 26, 'Male'),
(NULL, 'Holly', 'Flax', NULL, NULL),
(1013, 'Darryl', 'Philbin', NULL, 'Male')

Table 3 Query:
Create Table WareHouseEmployeeDemographics
(EmployeeID int,
FirstName varchar(50),
LastName varchar(50),
Age int,
Gender varchar(50)
)

Table 3 Insert:
Insert into WareHouseEmployeeDemographics VALUES
(1013, 'Darryl', 'Philbin', NULL, 'Male'),
(1050, 'Roy', 'Anderson', 31, 'Male'),
(1051, 'Hidetoshi', 'Hasagawa', 40, 'Male'),
(1052, 'Val', 'Johnson', 31, 'Female')

paulurian
Автор

Hi Alex, Just stopping by making a break from watching your videos in a row, to say thank you not only for the great and prompt explanatory videos but also keeping the eagerness on learning more about SQL and waiting for every next video to learn more. Having left SQL memories back to my IT college years because of following slightly different direction, but now after many years that i decided to refresh my knowledge i feel like i've been taught SQL so smoothly! We are definetely lucky to have inspiring people like you!

leonidasgoniotakis
Автор

Creating the warehouse table:

Table 3 Query:
Create Table WareHouseEmployeeDemographics
(EmployeeID int,
FirstName varchar(50),
LastName varchar(50),
Age int,
Gender varchar(50)
)

Table 3 Insert:
Insert into WareHouseEmployeeDemographics VALUES
(1013, 'Darryl', 'Philbin', NULL, 'Male'),
(1050, 'Roy', 'Anderson', 31, 'Male'),
(1051, 'Hidetoshi', 'Hasagawa', 40, 'Male'),
(1052, 'Val', 'Johnson', 31, 'Female')

javelynhazeldine
Автор

tldr: join = concat columns, union = concat rows

_slier
Автор

You are really not boring. I could watch your tutorials for hours without resting LOL. Keep up the good work Alex.

lindiwemhangwana
Автор

You've explained this concept more clearly than any other learning platform! Thank you!

haley
Автор

CTRL + SHIFT + R
Refresh local cache for Intellisense. Sometimes Intellisense doesn't recognize newly-created objects; this shortcut forces SSMS to refresh its object list in cache

RishithaNishadh
Автор

That ven diagram in the Join video was fantastic! That really helped me make sense of joins. Thank you! Great video!

Tammy-nuzz
Автор

Hi Alex, just stumbled upon your videos while searching for best ways on how to be a Data Analyst and I can say that, man, your videos are super helpful, better than when I was in my days as an IT student. Your videos are very easy to understand and so much engaging. Hope to be able to finish this all in just a few months and then I will take the certification with Google to complete my adventure to being a Data Analyst. Keep up the great work and videos and here's to hoping you will post more as the trend nowadays about technology are fast. Thank you!

shenbobis
Автор

Table 1 Insert:
Insert into VALUES
(1011, 'Ryan', 'Howard', 26, 'Male'),
(NULL, 'Holly', 'Flax', NULL, NULL),
(1013, 'Darryl', 'Philbin', NULL, 'Male')

Create new table:
CREATE TABLE
(EmployeeID int,
FirstName varchar(50),
LastName varchar(50),
Age int,
Gender varchar(50)
)

Add data to new table:
INSERT INTO VALUES
(1013, 'Darryl', 'Philbin', NULL, 'Male'),
(1050, 'Roy', 'Anderson', 31, 'Male'),
(1051, 'Hidetoshi', 'Hasagawa', 40, 'Male'),
(1052, 'Val', 'Johnson', 31, 'Female')

alejandrareyesvaldez
Автор

Hey Alex, it's 2024 and i just wanna say God bless you and your family.

momohtimothy
Автор

This is very similar to a concat/append when working with python pandas data frames.
Very cool

GabrielHernandez-snel
Автор

On my journey through the boot camp...

New learning again. Awesome!

JeffChavez
Автор

hello alex thanks to ur data analyst boot camp it have helped me so well in my DA journey i used it not just as a starting point into my DA journey but also as a guide as to the important things i need to learn even when i watch other tutorials u did so well on how u explain things and make it easier for anyone to understand. thank u for what u do may God bless u

entertainmentworld
Автор

Amazing work! Can't believe I am actually enjoying learning this

justicekipyegon
Автор

You are such a great teacher a looking forward to finish the Bookcamp and also perfecting my skills on SQL. Thank you so much. I follow you everywhere on your social media.😊

Ladyhadassah
Автор

Thank you for these kinds of videos! I'm a management information system major right now, and this is a great refresher for me. can't for all the other videos!

TauTauTau
Автор

Can't thank you enough Alex! Have learned so much from your videos, simply thanks!

georgezambrano
Автор

Hi Alex 🙋‍♀️ Thanks for making these good videos. I want to add - the order of datatype in selected columns should be same. Like in our case: int, varchar, int for both select queries. If this is not same in both (or more) select queries, then union fails.

ashishagrawal
Автор

Thanks Alex, this is indeed great.
You made join so easy to understand, gracias man!

abisolahawaw