Oracle Pivot with group total computation

Sdílet
Vložit
  • čas přidán 5. 09. 2024
  • Oracle Pivot with group total computation
    Watch this video for PIVOT clause
    • Oracle Pivot clause | ...
    Click here to subscribe to my youtube channel / @sivaacademy
    Oracle Interview questions and Answers at • oracle interview quest...
    Oracle 18C New features at • Oracle 18C New Feature
    Oracle 12C New features at • Oracle 12C New Feature...
    Oracle PLSQL records and collections at • oracle plsql records a...

Komentáře • 83

  • @murugesanpitchaikani4808
    @murugesanpitchaikani4808 Před 3 lety +4

    Hi, we are hard coded column values in pivot. Is it possible to pass dynamic query in pivot clause? Except xml...

  • @MrBandhuraj
    @MrBandhuraj Před 9 měsíci

    Great CZcams lesson. I learned a lot about pivot and cube. Question: if I have 2 aggregate sum() and count() in pivot the output is with 2 columns for each department displaying horizontally, How would you display sum() and count() in 2 different rows under a department column for each Job.

  • @sridhartamilselvan
    @sridhartamilselvan Před 5 lety +1

    Your's teaching skill is awesome 👌

  • @vijayarjunwadkar
    @vijayarjunwadkar Před 3 lety

    Nice video teaching use of Pivot in Oracle SQL. I was struggling with this a bit, but you clarified it in a detailed and smooth way! Thanks a lot! 😊👍 Watching your other videos too...

  • @VethakaliVethuku
    @VethakaliVethuku Před 3 lety +1

    Good Explanation :) Cube ,Rollup

  • @Hemanthmech
    @Hemanthmech Před 3 lety +1

    Excellent teaching thank you

  • @rahulbadhe5930
    @rahulbadhe5930 Před 5 lety +2

    thank you sir ,, its very good session.
    please take a performance tuning about session , its more needed.

    • @SivaAcademy
      @SivaAcademy  Před 5 lety

      @Rahul, Thanks for your comments, Sure will start posting performance related videos soon, Please stay tuned.

  • @Andhrasinchennai
    @Andhrasinchennai Před 2 lety

    Excellent explanation

  • @Anushkathecuteprincess

    Really very helpful.. but i want to implement it into dynamic columns, i have implemented the dynamic columns query but i want to add this logic on it. and one more i want to add other columns as well, how we can add other columns in group by

  • @niyije
    @niyije Před 2 lety

    Thank you a lot! it runs in Oracle

  • @sajeedshaik7280
    @sajeedshaik7280 Před 4 lety +1

    thanks for posting valuble info..

  • @karthikeyan9592
    @karthikeyan9592 Před 2 měsíci

    Great 👍

  • @VinayKumar-ij4eu
    @VinayKumar-ij4eu Před 2 lety

    Thanks Siva for this video!!

  • @surajmokatkar
    @surajmokatkar Před 4 lety

    Good Explanation.Precise.

  • @rk-ej9ep
    @rk-ej9ep Před 2 lety

    Excellent sir...

  • @chinarisubudhi8865
    @chinarisubudhi8865 Před 2 lety

    Nicely explained..

  • @sujaa1000
    @sujaa1000 Před 4 lety +2

    Siva,
    How is 'TOTAL' itself taken as a deptno, can you please explain that?
    The inner query has deptno, job and total_sal computed, but 'TOTAL' in "deptno in (10,20,30,'TOTAL') is confusing, where is 'TOTAL' computed?
    Regards,
    Sujaa

    • @SivaAcademy
      @SivaAcademy  Před 4 lety +1

      In the innser query where i have used the nvl(job, 'TOTAL') and nvl(deptno, 'TOTAL'), this will be used in the outer query to compute the overall total value

    • @sujaa1000
      @sujaa1000 Před 4 lety

      @@SivaAcademy Thank you Siva

  • @vaniganapathi830
    @vaniganapathi830 Před 2 lety

    Thank you so much sir

  • @janf5021
    @janf5021 Před 2 lety

    Oracle is unable to truely pivot dynamically. it works if you declare the column manually in the pivot statement, it does NOT work if you declare it with an inner select statement.
    The recommendation ist to go via XML, but this will NOT Produce a table column, it creates a XML Tag with a Single Column of the table.
    Then you can click a setting that PL/SQL or other INTERPRETE XML like a table - but it still is not.

  • @govindaraju3265
    @govindaraju3265 Před rokem

    Hi sir, well explained with a simple method. Thanks,I have a question like how to get row% and column% as we do in excel

  • @TamilManivs
    @TamilManivs Před 3 lety

    Outstanding teaching skill bro

  • @funzone123456
    @funzone123456 Před 4 lety

    very good video. pivot explanation simplified rather using traditional max decode logic

  • @md.rahimuddinshohag7202

    Thank you so much

  • @shashikumarn.s859
    @shashikumarn.s859 Před 3 lety

    Amazing teaching thanks

  • @vinaygajjelli8028
    @vinaygajjelli8028 Před 4 lety

    i have 10g in my lappy which is not usefull to do any pivot clause..it can be done from 11g version

  • @vsr1727
    @vsr1727 Před 4 lety

    Thanks Siva

  • @ramus6188
    @ramus6188 Před 2 lety

    SUB GROUP NOT MENTIONED. CAN WE EXPECT IT

  • @neverstopexploring5265

    It is very useful brother

  • @pankajkharade6936
    @pankajkharade6936 Před 3 lety

    Superb Sir 👍👍👍

  • @mahendra7121
    @mahendra7121 Před 3 lety

    Can we get same output without using pivot operation ?

  • @KrishnaPaneri
    @KrishnaPaneri Před 4 lety

    Thank you 👌🏿👍🏿

    • @SivaAcademy
      @SivaAcademy  Před 4 lety

      You’re welcome 😊

    • @SivaAcademy
      @SivaAcademy  Před 3 lety

      Please look into this video
      czcams.com/video/KzuWCLPomcY/video.html

  • @tharinduhasitha3618
    @tharinduhasitha3618 Před 4 lety

    Thanks

  • @bhushanpalse516
    @bhushanpalse516 Před 2 lety

    Sir if there are 3 tables in from clause,then how to use this pivot

    • @SivaAcademy
      @SivaAcademy  Před 2 lety

      Pivot is for result set of any query having any number of tables, inner query can have any number of tables

  • @dheenadhayalan2091
    @dheenadhayalan2091 Před 4 lety

    Thanks Very useful, can we use this qry in Oracle report to design same structure ?

    • @SivaAcademy
      @SivaAcademy  Před 4 lety

      Thanks bro, I am not sure about Oracle reports

  • @boyachi002
    @boyachi002 Před 4 lety

    How do i use pivot function by dynamic condition like below source ?
    pivot (sum(TiresShift) for BuildingStartShift in
    (
    select to_char(sysdate,'YYYYMMDD')||1 "NOW1",to_char(sysdate,'YYYYMMDD')||2 "NOW2",to_char(sysdate,'YYYYMMDD')||3 "NOW3"
    from dual
    ))
    order by 2,1
    ;

    • @SivaAcademy
      @SivaAcademy  Před 4 lety

      Pivot is not very flexible in terms of dynamic inputs, however you can explore 18C Polymorphic Table Functions

  • @deepakmeda8049
    @deepakmeda8049 Před 4 lety

    Super bro.

  • @BongFoody
    @BongFoody Před 4 lety

    Sir, I didnt understand why you wrote sum(sal) in the pivot section. As we are already having all the totals using the cube clause, so what the pivot sum(sal) is doing.

    • @BongFoody
      @BongFoody Před 4 lety

      I think i found the answer - the sum(sal) in the pivot section is just giving the sum group by job from the inner query, but as the innerquery has all the unique permutation/combination- thus providing the same reault as transposed in the final output. Sir, Please correct in case i an having wrong understanding.

    • @SivaAcademy
      @SivaAcademy  Před 4 lety

      You are right, anyway we are having unique combination in inner query, outer sum is not needed, but we added just for the pivot syntax, otherwise pivot won't work

    • @BongFoody
      @BongFoody Před 4 lety

      Thanks Sir

  • @849ramzes
    @849ramzes Před 4 lety

    Gj Buddy 👍🏻

  • @pranayk2840
    @pranayk2840 Před 4 lety

    Hello Sir, I'm getting the below error:
    ORA-01748: only simple column names allowed here

    • @SivaAcademy
      @SivaAcademy  Před 4 lety

      can you please send me the query you tried.

  • @reshmabahadur7564
    @reshmabahadur7564 Před 3 lety

    Siva, how much will b charged for the complete course and duration??

    • @SivaAcademy
      @SivaAcademy  Před 3 lety

      please drop mail to siva.k.academy@gmail.com

  • @alladivamshikrishna228

    hi sir, can we do cummilative sum to some particular rows in one column.

    • @SivaAcademy
      @SivaAcademy  Před 4 lety +1

      Yes, you can write entire query in inner subquery, and in outer query you compute cumulative sum

    • @alladivamshikrishna228
      @alladivamshikrishna228 Před 4 lety

      ​@@SivaAcademy
      emp_id emp_sal cummilative sum
      ----------- ------------ ---------------
      ------------
      1 10 ------------------- 10 (as it is)
      2 35 ------------------- 45 (cummilative sum.i.e, 35+10=45)
      3 55 ------------------- 55 (as it is)
      4 40 ------------------- 40 (as it is)
      5 35 ------------------- 75 (cummilative sum.i.e, 35+40=75)
      6 85 ------------------- 85 (as it is)
      7 25 ------------------- 25 (as it is)
      8 65 ------------------- 90 (cummilative sum.i.e, 65+25=90)
      9 45 ------------------- 45 (as it is)
      10 65 ------------------- 65 (as it is)
      This is requirement sir, is this possible? if it is possible, can i have query for that.

  • @reshmabahadur7564
    @reshmabahadur7564 Před 3 lety

    👍👍

  • @tejupansare4947
    @tejupansare4947 Před 4 lety

    U r any institute available in Pune