Hi All,
My name is Ankit Shrivastava and I am a Data Engineer.
Today this #vlog is regarding #sql
What is the difference between WHERE & AND clause with LEFT/RIGHT join ?
What is happening when we use same condition with WHERE clause & AND clause with JOINS and also I am discussing INNER join + WHERE clause is giving same result with LEFT join + WHERE clause
Is output is going to be same ?
select * from emp e left join dept d on e.dept_id = d.dept_id WHERE e.salary = 1000;
select * from emp e left join dept d on e.dept_id = d.dept_id AND e.salary = 1000;
Please find the DDL for practice:-
create table emp (emp_id int, emp_name varchar(20),dept_id int, salary int);
insert into emp values(100,'Ankit',1,1000);
insert into emp values(101,'Saurabh',1,2000);
insert into emp values(102,'Kushal',2,3000);
insert into emp values(103,'Farhan',2,5000);
insert into emp values(104,'Varun',3,6000);
create table dept (dept_id int, dept varchar(20));
insert into dept values (1,'IT');
insert into dept values (2,'HR');
insert into dept values (3,'SALES');
#sqlinterviewquestionsandanswers #dataanalysts #dataengineering #dataanalysis
Please find the link of my all previous videos:-
#sql How to handle NULL while aggregation | SUM() | AVG() | Data Analyst | Data Engineer |Math calc
Link • #sql How to handle NUL...
#sql Calculate start & end time and average time spent in successful transaction | startup interview
Link • #sql Calculate start &...
#sql to achieve last NOT NULL value from the record | Analytical Function | Data Engg | Data Analyst
Link www.youtube.co....
#sql to identify Top Performing Product every Quarter of each year | Highest sale every quarter
Link www.youtube.co....
#sql Interview Question - Calculate Running Total | Cumulative sum | UNBOUNDED PRECEDING FOLLOWING
Link www.youtube.co....
#sql Interview question - Schedule cricket match between teams and generate points table using SQL
Link lnkd.in/dsM8Pe8B
#sql Interview Questions - All JOINS (INNER, LEFT, RIGHT, FULL OUTER) | JOIN only NULL values
Link lnkd.in/dJttWQBB
#sql Interview Question - What is the difference between COUNT(*), COUNT(1) and COUNT(-1)
Link lnkd.in/dVHMWxKj
#SQL Interview Question - How to delete duplicate record from table
Link lnkd.in/dcVyhC7X
#SQL Interview Question -Second highest salary using dense rank analytical function
Link lnkd.in/daBumQfB
#SQL to pull unique record after combination of column
#SELFJOIN
Link lnkd.in/d6tXYXCv
11 сен 2024