How and why a sql inner left right full and cross join returns the same row count
Вставка
- Опубліковано 23 жов 2020
- All SQL join types produce same result - Why and How ?
All the SQL queries used in the demo are on our blog at the following link.
csharp-video-tutorials.blogsp...
Joins in SQL Server Video
• Joins in sql server - ...
Let's gift education together
/ kudvenkat
How to become a full stack web developer
• How to become a full s... - Наука та технологія
What can I say about this guy ?? There is no even words to explain how you helped me you saved my life . Your explanation 100000% . No words for you just May God bless and give you what ever you wishes. I wish I can contact you via phone. I want talk to you to explain my deepest gratitude 🙏🏻. Bless you More and more . You are priceless brother
I can never thank you enough for all your wonderful videos, Venkat. You have a gift for explaining things in an easy to understand way. My current job is requiring more advanced SQL than I've ever had to write before, so I always check your channel for help if I run into any blocks.
Cheers!
Thank you very much for the feedback and all the kind words. Means a lot. Made my day.
Thank you so much for creating the SQL playlist, sir. It's one of the best SQL tutorials available online!
You are very welcome Srinivas. Means a lot. To be honest feedback like this motivates and keep me going. Thank you very much for taking the time.
Hello Sir,
Just wanted to thank you for creating SQL Playlist. By watching these videos it gets easy to crack an interview. I want to ask you that could you please create the same playlist for SSIS, SSAS, SSRS, and Power BI if possible. It would really help us to understand the concepts as an MSBI Developer. Thank you in advance and looking forward to your reply.
Hi Venkat, Thank you so much for sharing amazing content. I have a quick question could you please let us know how to avoid these scenarios in real time.
Hello sir, First of all I would like to Thank you for your effort for us.
I want to ask you that will you Please create a course for Database Design.
Because I have searched this course on youTube so much but I've not found a single course that is easy and understandable as your content.
Please ans..
Thanks!
Awesome Explanation sir
Thank you so much for videos sir
this is the question it was asked for me yesterday interview I have answered only two correctly 😅
Great explanation ✌️
Hi Sir,
Hope you are doing very good.
Your videos are very very helpful.
Your voice is changed. It different in C# videos.
Wish you have a long life.
cloud you please tell me how can I download the database that you are using to practice? thank you.
Hlo sir, will you continue with git and angular 6 playlist?
This is fun because it takes us out of the data we see in our day-to-day. Usually we join normalized tables using an identity column and so there is no repetition of the IDs and so an inner join would never end up looking like a cross join.
You are 100% correct Alex. We wouldn't see something like this in a real world application. May be the interviewer who asked this question was trying to see how good the interviewee JOINS knowledge is.
@@Csharp-video-tutorialsBlogspot Yes, of course that's the only reason for the question. Unless the interviewer is giving a subtle hint to the interviewee that any DB work at that company is going to be hell because they haven't normalized anything and don't know what PKs are. :D
U are wonderful teacher in the Software Environment ..
Thank you very much Prasad. Hope you are finding our free courses useful.
@@Csharp-video-tutorialsBlogspot if it is possible please do More Example Videos on User define Functions Sir
what if table 1 has 1 column with values (1,2,2,Null) and table 2 has 1 column with values (1,2,2) the join(left,right, inner) query output result is confusing. Could you please help to understand it. thanks in advance
Today the same question was asked for me in the interview.. What is the answer for this question please tell..
Heelo Sir, thanks for your job. just one question: your c# playlist in your UA-camchannel is always availabe?
I ask it because you made video since 2012. Thanks again
Hello Vauvau - Yes, it will always be available just like every other video and playlists. Hope this answers your question.
@kudvenkat ... Explanation is really superb. But if the column A [1,2] and column B [1,1,2] . Then the output will be 3 rows right
Yes except cross join which have 6 rows in the input
Missing you venkat😢
Start uploading the videos again👍
Very nice 👍, I have a doubt "does it mean every join always do Cartesian product then it filters result based on join type and condition or this happened here because of special case of duplicate data?"
Hi Gaurav - Sorry if I have confused you. No, the other joins like inner join, left outer join, right outer join, full outer join does not behave like cross join. In this case they return the cartesian product because the join columns have same values as you said. Thank you for taking the time to ask this question.
Hello Sir, I am Suresh. I have watched videos regarding recursive CTE but I was unable to understand. Please make a video by explaining below 2 Queries Like you explained part 3 How does a recursive CTE work with the help of excel. It's my Humble request. Thank You
;With CTE
as
(
select ID, Name, Occurrence from #Task
Union all
select ID, Name, Occurrence - 1 from CTE Where Occurrence > 1
)
select ID, Name from CTE Order By ID
Go
;With CTE
as
(
select 1 as Number
union all
select Number + 1 as Number from CTE where Number < 5
)
select * from CTE
very helpful video's but Where is the original Venkat?
Your voice has been changed.... Totally different if it is compared with your SQL server tutorial 10 years ago
Hi Sir,
Pls answer Display nth row in sql Server, how to find alternate rows in sql server and how to find first and last nth rows in sql server
From table A only one column is there ? How can you select coulumn B from table A
Is this particulat to this scenario. For eg when i try with a different example say Drop table Departmen
Create Table Departmen
(
DepartmentID int primary key,
DepartmentName nvarchar(50)
)
GO
Drop Table Employee
Create Table Employee
(
EmployeeID int primary key,
EmployeeName nvarchar(50),
DepartmentID int foreign key references Departmen(DepartmentID)
)
GO
Insert into Departmen values (1, 'IT')
Insert into Departmen values (2, 'HR')
Insert into Departmen values (3, 'Payroll')
GO
Insert into Employee values (1, 'Mark', 1)
Insert into Employee values (2, 'John', 2)
Insert into Employee values (3, 'Mike', 1)
Insert into Employee values (4, 'Mary', 2)
GO
select * from Departmen
select * from Employee
select DepartmentName, Count(e.DepartmentID) as TotalEmployees
from Employee e right join Departmen d on e.DepartmentID = d.DepartmentID
group by DepartmentName
order by DepartmentName
select *
from Employee e right join Departmen d on e.DepartmentID = d.DepartmentID
--no of rows returned 5
select *
from Employee e left join Departmen d on e.DepartmentID = d.DepartmentID
--no of rows returned 4
select *
from Employee e full join Departmen d on e.DepartmentID = d.DepartmentID
----no of rows returned 5
select *
from Employee e inner join Departmen d on e.DepartmentID = d.DepartmentID
--no of rows returned 4
select *
from Employee e cross join Departmen
--no of rows returned 12 so this is not a general scenario where joins return a fix number in result everytime.... just posting cause when i first watched the video i thoight this is always true when using joins.. so i thought i put this up.....
thanks for the great content though!!
Sir please make tutorials for Data structures and algorithm using c#
Hi Tarun - Great suggestions. Sure, we will after Azure tutorial. Thank you for understanding and your patience.
Hello sir,
do you have plan to pulish Azure course please?
Hello Rebwar - Yes, sorry to keep you all waiting. Azure is indeed our next course. Thank you.
I feel previous Vedio s voice is different in this vedio voice may be he is not Venkat
Thanks for your videos. I am working as a desktop support. Is this possible to change my career to DATABASE.
Hello Mohamed - You are very welcome. Sure you can Mohamed. Our free SQL Course can help.
www.pragimtech.com/courses/sql-server-tutorial-for-beginners/
Thanks Mr.kudvenkat
Good morning sir, Happy Dussera , can u make videos on SSAS Tabular model...
Morning Sravan. Happy Dussera to you too. As I promised to many people we will start Azure tutorial next. May be sometime in the future I will do a video on the tabular model. Thank you for your understanding and patience.
@@Csharp-video-tutorialsBlogspot Thanks sir.your way of explanation is awesome 👌
What is the reason sir. My guess is we are joining columns which is having same values.....
Hi Nandhini - Yes, you nailed it. 100% correct. It's because of the matching values on the join columns.
Amazon Data Engineering position, question was asked.
if both the tables have only one row each with the same value, the result will be same !