Scenario Based SQL Question Solving Using SCD Type 2 Concept SQL Interview Question

Channel Avatar
Comment
X
Share
Scenario Based SQL Question Solving Using SCD Type 2 Concept SQL Interview Question
Scenario Based SQL Question Solving Using SCD Type 2 Concept SQL Interview Question
In this video we will discuss a scenario based SQL problem. I will be solving it using Analytical function. You will learn how to use Lead analytical function with partition by clause and how to deal with data ranges in SQL.

Here is the ready script:

create table billings
(
emp_name varchar(10),
bill_date date,
bill_rate int
);
delete from billings;
insert into billings values
(‘Sachin’,’01-JAN-1990′,25)
,(‘Sehwag’ ,’01-JAN-1989′, 15)
,(‘Dhoni’ ,’01-JAN-1989′, 20)
,(‘Sachin’ ,’05-Feb-1991′, 30)
;

create table HoursWorked
(
emp_name varchar(20),
work_date date,
bill_hrs int
);
insert into HoursWorked values
(‘Sachin’, ’01-JUL-1990′ ,3)
,(‘Sachin’, ’01-AUG-1990′, 5)
,(‘Sehwag’,’01-JUL-1990′, 2)
,(‘Sachin’,’01-JUL-1991′, 4)

#sql #scenariobased #interview

Take the opportunity to connect and share this video with your friends and family if you find it useful.

Keywords: sql, sql interview questions, amazon interview questions, sql interview questions and answers, scd type 2, scenario based sql interview question, data engineer sql interview questions

Read Also

Leave a Reply

Your email address will not be published. Required fields are marked *