المدة الزمنية 7:42

Cube in SQL Server

بواسطة kudvenkat
109 362 مشاهدة
0
739
تم نشره في 2015/09/22

group by cube in sql server 2008 cube group by sql sql server group by cube example sql server cube group by Cube() in SQL Server produces the result set by generating all combinations of columns specified in GROUP BY CUBE(). Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help. /channel/UC7sEwIXM_YfAMyonQCrGfWA/ Let us understand Cube() in SQL Server with examples. Write a query to retrieve Sum of Salary grouped by all combinations of the following 2 columns as well as Grand Total. Country, Gender Using Cube with Group By SELECT Country, Gender, SUM(Salary) AS TotalSalary FROM Employees GROUP BY Cube(Country, Gender) --OR SELECT Country, Gender, SUM(Salary) AS TotalSalary FROM Employees GROUP BY Country, Gender with Cube The above query is equivalent to the following Grouping Sets query. SELECT Country, Gender, SUM(Salary) AS TotalSalary FROM Employees GROUP BY GROUPING SETS ( (Country, Gender), (Country), (Gender), () ) The above query is equivalent to the following UNION ALL query. While the data in the result set is the same, the ordering is not. Use ORDER BY to control the ordering of rows in the result set. SELECT Country, Gender, SUM(Salary) AS TotalSalary FROM Employees GROUP BY Country, Gender UNION ALL SELECT Country, NULL, SUM(Salary) AS TotalSalary FROM Employees GROUP BY Country UNION ALL SELECT NULL, Gender, SUM(Salary) AS TotalSalary FROM Employees GROUP BY Gender UNION ALL SELECT NULL, NULL, SUM(Salary) AS TotalSalary FROM Employees Text version of the video http://csharp-video-tutorials.blogspot.com/2015/09/cube-in-sql-server.html Slides http://csharp-video-tutorials.blogspot.com/2015/09/cube-in-sql-server_22.html All SQL Server Text Articles http://csharp-video-tutorials.blogspot.com/p/free-sql-server-video-tutorials-for.html All SQL Server Slides http://csharp-video-tutorials.blogspot.com/p/sql-server.html All Dot Net and SQL Server Tutorials in English /user/kudvenkat/playlists?view=1&sort=dd All Dot Net and SQL Server Tutorials in Arabic /c/KudvenkatArabic/playlists

الفئة

عرض المزيد

تعليقات - 49
  • @
    @Partap779منذ 9 سنوات I have no words to express my gratitude to you, I am 0 to Hero in SQL after watching your SQL videos Series! 31
  • @
    @manishdubey8646منذ 8 سنوات Realy appreciable..Your all videos are awesome. I have seen all and implement in my project..very clearly understanding. Also I have shared multiple people id="hidden2" class="buttons"> who doesn't know about SQL. Multiple friends got a job only credit goes to your videos. ....وسعت 1
  • @
    @962tusharمنذ 4 سنوات have been trying to see what a cube looks like for so long. Finally found it. This helps me get dimensional modeling. Thanks. 1
  • @
    @FlareSoul69منذ 5 سنوات I am a Sr Analyst now. making 100k+. All due to watching Venkat's videos several years ago. This man is a blessing and his videos are top notch! 6
  • @
    @vinothchinnasamy1912منذ 7 سنوات One of the best tutorials I have ever watched. Thanks a lot. Keep up the good work.
  • @
    @88spacesمنذ 5 سنوات Great insight into cubes and groupings. It helped me a lot. Thank you.
  • @
    @charliegordon13منذ 7 سنوات Great description of an incredibly complicated subject. Thanks for putting in the time.
  • @
    @sksingh763منذ 8 سنوات you are the best, I really appreciate you sharing this video with you. wonderful!!
  • @
    @krzysztofs8535منذ 7 سنوات Thank U very much for your work. I'm the greatest fan of your tutorial. God bless you! 1
  • @
    @muhammadrehbarsheikh8498منذ 9 سنوات thanks venkat sir.. excellent explanation. go ahead.. god bless you!!! 1
  • @
    @saadrouane6521منذ 5 سنوات Great video easy to follow through and comprehend! Thank you
  • @
    @bouchrab5434منذ 4 سنوات this videos are still so helpful ! there is always something to learn and he's the only one I truly understand to be honest !
    Thank you very much teacher :)
  • @
    @avinashmamidiمنذ 9 سنوات Sir,
    Could you please make similar videos for SSIS,SSRS and SSAS
    9
  • @
    @learnwithharry8971منذ 8 سنوات this is the best explanation i've ever seen, thank you
  • @
    @yoanperez172منذ 2 سنوات Excellent video, very clear, thank you!
  • @
    @jcsrmprasمنذ 9 سنوات Hi sir,this is Prasanna with the help of your video tutorials..i learned dotnet and sql.They helped me in clearing my interview..Im appointed as a Dot id="hidden5" class="buttons"> Developer in a software company..Thank you very much for your help ..They are very much helpful from a beginner to an experienced person ..You can write a book for .net interview questions .. ....وسعت 4
  • @
    @ushareddy3323قبل 8 أشهر Really thanks for your efforts its really useful u covered every topic . i am grateful to you sir
  • @
    @Advaniumمنذ 7 سنوات Thank you! Now I know what a Cube is and how to even create one in several different ways, sweet!
  • @
    @wadungalungasertotinمنذ 9 سنوات Hi, do you have any material related to spatial data bases? 2
  • @
    @36795811منذ 5 سنوات Cool, for 5 min, I became smarter for one more command. Thx.
  • @
    @guillifrمنذ 5 سنوات Great explanation!!! Step by step to the point!
  • @
    @michaelnewman9645منذ 9 سنوات A brilliant series. Thank you.Have you any intention of producing a tutorial on how to insert images into SQL Server? 1
  • @
    @JohnWaclawskiمنذ 5 سنوات Is the database you use available for download? Or is it one of the adventureworks databases? If so, which one?
    Thank you!! I always find something useful in your videos. Keep up the great work!!
  • @
    @tannertucker22منذ 7 سنوات Some of the best tutorials that I have seen! What is the difference between rollup and cube please? Thank you.
  • @
    @ashishrao5635منذ 9 سنوات Hi, Could you also explain how to us Red Gate s/w for transferring data from one server to another 1
  • @
    @JohnWaclawskiمنذ 4 سنوات I know this is a fairly old video, but any chance we can get the sample database you were using?
    Thank you for all you do. I've watched many id="hidden7" class="buttons"> of your videos and you make everything very easy to understand and to follow.
    EDIT: Funny but I watched this video 4 months ago & commented on it then too. Still looking for the sample DB you used. ;)
    ....وسعت
  • @
    @shrikant1311منذ 5 سنوات Hi Sir , can you please make similar videos for MSBI like SSIS,SSRS and SSAS Classes
  • @
    @Md308111منذ 5 سنوات Hi Kudvenkat Hope you are doing Good
    Can you please upload videos on SSAS,SSRS AND SSIS as there are no. of videos in u tube but no one clarify, understand better then you.
  • @
    @SanjayKumar-yh8fdمنذ 3 سنوات bhut dhanyabad guru ji padane ki liye, dasi tippni sivikar kare
  • @
    @vineet1034منذ 4 سنوات It that same as:
    Select Country,gender, Sum(Salary) TotalSalary
    From Employees group by rollup(gender,country)
    right ?
  • @
    @LuigiZambettiمنذ 5 سنوات Where I can find the script to create the database used in these examples?
  • @
    @manishdubey8646منذ 8 سنوات Realy appreciable..Your all videos are awesome. I have seen all and implement in my project..very clearly understanding. Also I have shared multiple people id="hidden9" class="buttons"> who doesn't know about SQL. Multiple friends got a job only credit goes to your videos. ....وسعت 1
  • @
    @jcsrmprasمنذ 9 سنوات Hi sir,this is Prasanna with the help of your video tutorials..i learned dotnet and sql.They helped me in clearing my interview..Im appointed as a Dot id="hidden12" class="buttons"> Developer in a software company..Thank you very much for your help ..They are very much helpful from a beginner to an experienced person ..You can write a book for .net interview questions .. ....وسعت 4
  • @
    @JohnWaclawskiمنذ 4 سنوات I know this is a fairly old video, but any chance we can get the sample database you were using?
    Thank you for all you do. I've watched many id="hidden14" class="buttons"> of your videos and you make everything very easy to understand and to follow.
    EDIT: Funny but I watched this video 4 months ago & commented on it then too. Still looking for the sample DB you used. ;)
    ....وسعت