SQL Query - Convert data from Rows to Columns | Pivot

  Рет қаралды 194,161

Learn at Knowstar

Learn at Knowstar

Күн бұрын

Пікірлер: 57
@LearnatKnowstar
@LearnatKnowstar 2 жыл бұрын
Register at the below link to get US $100 off for Coursera Plus membership between Sep 8 - Sep 29, 2022. The Coursera Plus membership gets you access to unlimited courses and unlimited certifications! imp.i384100.net/Ke51on
@hmukai001
@hmukai001 4 жыл бұрын
Went over many googled articles and they were filled with jargons and did not make any sense to me. After all that, I came across your clip and its solved all the mystery. Thanks for making it so simple to understand!
@LearnatKnowstar
@LearnatKnowstar 4 жыл бұрын
Thank you for your kind words.
@jacksparrowcapitan3232
@jacksparrowcapitan3232 3 жыл бұрын
Your voice is attractive day by day Teacher !!! Great content as always
@kristyowens2284
@kristyowens2284 4 жыл бұрын
Learned a new SQL function today - interesting. Thanks.
@LearnatKnowstar
@LearnatKnowstar 4 жыл бұрын
Thank you
@sherrimcdonald2382
@sherrimcdonald2382 4 жыл бұрын
Thank you for this. I learned about a much needed function in order for me to build a ssrs report.
@LearnatKnowstar
@LearnatKnowstar 4 жыл бұрын
Thank you. Glad that you found this useful.
@RamPrasad-io2kz
@RamPrasad-io2kz 2 жыл бұрын
Thank you ma'am it is very helpful this pivot function for my automations
@LearnatKnowstar
@LearnatKnowstar 2 жыл бұрын
Thank you. Glad that it was useful.
@shirishshukla9833
@shirishshukla9833 3 жыл бұрын
What does max function do here? Why was the aggregate needed?
@sindhuratridandapani9750
@sindhuratridandapani9750 3 жыл бұрын
Hi . This video is informative. However, I am looking for a pivot function when there are all String columns . What aggregate function can we use for String column?
@anudharsanbaskar3284
@anudharsanbaskar3284 Жыл бұрын
@sindhuja tridandapani hii
@AndrewJens
@AndrewJens Жыл бұрын
She gives the answer in the video: the max() function.
@bw424
@bw424 3 жыл бұрын
It's not ideal that you have to know the values to use as pivot table columns. What if you wanted to base it off a sequential order? Like have the top value as the first column, the second value as the second column, etc. That way you could grab the top results and pivot them in order. I think this would be pretty easy to do in pandas.
@LearnatKnowstar
@LearnatKnowstar 3 жыл бұрын
Sure pandas are very effective
@AndrewJens
@AndrewJens Жыл бұрын
The only way to have a variable number of output columns (from a PIVOT query) is to preconstruct the desired SELECT column names in a string variable and then use it to construct the entire PIVOT query as a string variable, which you can then run via the execute() command (i.e. use dynamic SQL). To construct the SELECT column names, look to use something like: set @cols = (select string_agg(quotename(), ',') from (select...) as t)
@arunv1909
@arunv1909 2 жыл бұрын
does this wroks in sql workbench ?i guess pivot dont work in tat
@sweetysweetyvghb
@sweetysweetyvghb 3 жыл бұрын
Mam..Pls explain how to write the Pivot query if multiple records are present ...do we need to use partitions in the query ?
@junevutran3986
@junevutran3986 3 жыл бұрын
Thank you so much. This is what I am looking for
@LearnatKnowstar
@LearnatKnowstar 3 жыл бұрын
Thanks so much!
@milloons2847
@milloons2847 2 жыл бұрын
Thanks, clear and concise tutorial.
@LearnatKnowstar
@LearnatKnowstar 2 жыл бұрын
Thank you
@karthikj9326
@karthikj9326 2 жыл бұрын
hello mam, this is very helpful, however, was wondering if you have any video anywhere of yours on multiple pivot
@ThePHnunes
@ThePHnunes 3 жыл бұрын
How can i do that, when i want to show more than one row in that case? Example: I have a city name (collumn name) and in the rows i will put the name of the places. If i put MAX on the pivot, they show me only 1 row, but i need that they show me all the places... i need use another function, or pivot can attend me?
@ruchiagrawal3029
@ruchiagrawal3029 2 жыл бұрын
How to do this for both , and blank separator
@LearnatKnowstar
@LearnatKnowstar 4 жыл бұрын
We have received your SQL Queries asked in interviews and plan videos soon answering those. If you wish to share some more, put them down in the comments below or send us an email! Happy Learning with Learn At Knowstar!
@LearnatKnowstar
@LearnatKnowstar 3 жыл бұрын
You can avoid hardcoding the pivot column names by using dynamic pivot. Here is the video tutorial link kzbin.info/www/bejne/d5PRZKpmer6CnJY
@MaxyX
@MaxyX 3 жыл бұрын
You a genius
@houstonfirefox
@houstonfirefox 2 жыл бұрын
Good video. Going forward and when producing education content, please refrain from using reserved words such as "Name" and "Value" in your SQL code. It makes me cringe when I see developers use reserved words as column names.
@LearnatKnowstar
@LearnatKnowstar 2 жыл бұрын
Thank you. Will keep this in mind 👍
@babun4915
@babun4915 Жыл бұрын
Hi great work ...!! Can we have a entire course like video in converting the queries or stored procedures from oracle to ms sql
@CiprianZahariaRO
@CiprianZahariaRO 4 жыл бұрын
Nice explanation
@LearnatKnowstar
@LearnatKnowstar 4 жыл бұрын
Thank you
@pradeepkumar-xt5dy
@pradeepkumar-xt5dy 4 жыл бұрын
It's very useful
@LearnatKnowstar
@LearnatKnowstar 4 жыл бұрын
Thank you
@haederoth
@haederoth 2 жыл бұрын
Hello. If someone can help --> What code lines need to be added in order to copy the result of this query into an other table of the database ? Many thanks !!!!
@houstonfirefox
@houstonfirefox 2 жыл бұрын
Use the SELECT * INTO newtablename FROM (subquery) alias (subquery) would refer to the entirety of the SQL as shown in the video. "alias" can be any word you'd like to refer to the subquery as.
@hulkbaiyo8512
@hulkbaiyo8512 2 жыл бұрын
okay, tbh I think first method is easy to understand and use. but probably second one is common use. I just don''t like that pivot format
@operationbroomstick
@operationbroomstick 2 жыл бұрын
Thank you ☺️
@LearnatKnowstar
@LearnatKnowstar 2 жыл бұрын
Glad it was helpful.
@Beyondhorizons-i5z
@Beyondhorizons-i5z 4 жыл бұрын
Wow. Didn't know about this function.
@LearnatKnowstar
@LearnatKnowstar 4 жыл бұрын
Thank you
@gashok5231
@gashok5231 2 жыл бұрын
How to pivot a row word 'oracle'as column can anyone write syntax
@widzewisze8475
@widzewisze8475 3 жыл бұрын
hi ! nice video thanks alot ;but what about N rows ? i mean in rows >3 ?
@LearnatKnowstar
@LearnatKnowstar 3 жыл бұрын
Thank you. You can use the same logic and extend the SQL for more than 3 rows as well. You need to mention the additional rows as pivot columns and values.
@DeoFederickDuran223
@DeoFederickDuran223 4 жыл бұрын
THIS JUST SAVE ME!! wew
@LearnatKnowstar
@LearnatKnowstar 4 жыл бұрын
Thank you
@akhandbharat2463
@akhandbharat2463 3 жыл бұрын
But keep up the good work
@akhandbharat2463
@akhandbharat2463 3 жыл бұрын
Need to work on the way you explain. It’s difficult to understand
@srirammaddula5661
@srirammaddula5661 Жыл бұрын
Yes.
@RameshK-rn3hf
@RameshK-rn3hf 3 жыл бұрын
Please improve the Video quality, otherwise it is very good
@miguelcastillo7346
@miguelcastillo7346 3 жыл бұрын
Izi pizi to understand
@LearnatKnowstar
@LearnatKnowstar 3 жыл бұрын
Thank you
@nimmanigga4473
@nimmanigga4473 3 жыл бұрын
Select * from dbo.Emp Select ID,[Name],[Gender],[salary] from (Select ID,Name as EName, Value From dbo.Emp) as Source_Table PIVOT (Max(Value) For EName in ([Name], [Gender], [Salary]) ) as Pivot_Table
@joesyereadi9078
@joesyereadi9078 3 жыл бұрын
Please help me, what if i have 2 tables.. the first table contains: id, name, age, the second tables contains : idage16, idage17,idage18 like this: table 1 people table 2 age ---------------------------- ------------------------------------------------- id name age ideage16 ideage17 ideage18 ---------------------------------------------------------- -------------------------------------------------------------------- 1 joe idage16 90 80 70 the question is how can i get value in the third table like this id name age point ------------------------------------------------------------------- 1 joe idage16 90 pliss help me for make videos...
SQL Query | How to dynamically convert rows into columns | Dynamic Pivot
16:18
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 62 МЛН
SQL | Pivot | Case | Convert data from Rows to Columns
7:14
Learn at Knowstar
Рет қаралды 50 М.
you need to learn SQL RIGHT NOW!! (SQL Tutorial for Beginners)
24:25
NetworkChuck
Рет қаралды 1,6 МЛН
Capgemini SQL Interview Question 2024 | Transform Rows Into Columns
5:32
Data Science Corner
Рет қаралды 3,7 М.
PIVOT IN SQL | Advanced SQL | Ashutosh Kumar
18:37
Ashutosh Kumar
Рет қаралды 10 М.
Learn Database Normalization - 1NF, 2NF, 3NF, 4NF, 5NF
28:34
Decomplexify
Рет қаралды 2,2 МЛН
Solving SQL Query | Rows to Column in SQL
1:13:11
techTFQ
Рет қаралды 180 М.
Part 6   Transform rows into columns in sql server
8:53
kudvenkat
Рет қаралды 396 М.
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН