In this video we see how to pivot data in SQL.
Pivoting is done in SQL when we want to transfer data from row level to column level and Unpivoting in SQL is done when we want to convert data from column level to row level.
Here we see how to pivot data using CASE statement in SQL.
DDL for the table used :-
--table
--pivot_table
/*
create table pivot_table(
name varchar(250),
data varchar(250),
id int
)
insert into pivot_table(name,data,id)
values('name','lewis',110),
('department','IT',110),
('experience','2',110),
('salary','4000',110),
('name','george',112),
('department','Finance',112),
('experience','1',112),
('salary',' 2500',112)
*/
"Thanks for watching. If you liked this video, make sure to subscribe for more!”
#dataprojecthub
#data_project_hub