Row Number function in SQL Server

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ต.ค. 2024

ความคิดเห็น • 77

  • @krzysztofs8535
    @krzysztofs8535 7 ปีที่แล้ว +33

    Row number rules ! And Venkat rules! You are the best teacher on youtube and in the whole world. I saw all your videos from SQL Server tutorial. Thank U for educating community! God bless you.

  • @piyako3586
    @piyako3586 5 หลายเดือนก่อน

    Tried so many videos on TH-cam after a few minutes I come out of it as I don't understand what they are talking about. You are the best:) Explained all concepts very clearly I found not just a good teacher but also a great soul :) Your voice is very soothing and pleasant on the ears wanting to listen more and more. God Bless you and Thanks once again

  • @tenziny9253
    @tenziny9253 7 ปีที่แล้ว +6

    GREAT TEACHER! I have been using your videos to reference SQL where I have no clues. Thanks for all your hard works!

  • @sayeedm6038
    @sayeedm6038 2 ปีที่แล้ว +3

    Very well explained! Keep making such amazing tutorials!

  • @MrHorzel
    @MrHorzel 7 ปีที่แล้ว +5

    Really well explained. Thank you. I really appreciate that you explained the use of it, more people should add that 'cause it's not always clear.

    • @Csharp-video-tutorialsBlogspot
      @Csharp-video-tutorialsBlogspot  7 ปีที่แล้ว +2

      You are very welcome and thank you very much for taking time to give feedback. This means a lot. I am very glad you found the videos useful.
      I have organised all the Dot Net & SQL Server videos in to playlists, which could be useful to you
      th-cam.com/users/kudvenkatplaylists?view=1&sort=dd
      If you need DVDs or to download all the videos for offline viewing please visit
      www.pragimtech.com/kudvenkat_dvd.aspx
      Slides and Text Version of the videos can be found on my blog
      csharp-video-tutorials.blogspot.com
      Tips to effectively use my youtube channel.
      th-cam.com/video/y780MwhY70s/w-d-xo.html
      If you want to receive email alerts, when new videos are uploaded, please subscribe to my youtube channel.
      th-cam.com/users/kudvenkat
      If you like these videos, please click on the THUMBS UP button below the video.
      May I ask you for a favor. I want these tutorials to be helpful for as many people as possible. Please share the link with your friends and family who you think would also benefit from them.
      Good Luck
      Venkat

    • @sudhakarjampanna3945
      @sudhakarjampanna3945 4 ปีที่แล้ว

      @@Csharp-video-tutorialsBlogspot - Do you provide training on SQL SERVER DBA /Azure DBA..or any videos on Clustering and login users /different types of roles or access in sql. my number 9030014648

  • @aprillong4805
    @aprillong4805 2 ปีที่แล้ว

    Thank you! After many videos, I finally get it! 👍🏾🎉🙏🏾

  • @rajeshkumar-ii8bb
    @rajeshkumar-ii8bb 2 ปีที่แล้ว

    Your explanation was amazing....Tq very much

  • @mohamedabbes6064
    @mohamedabbes6064 2 ปีที่แล้ว

    Thank you so much, you videos are addictive great explanation.

  • @ravishankar0901
    @ravishankar0901 4 ปีที่แล้ว

    Well explained, going forward I am going to search any sql issue with your name on youtube.

  • @kebincui
    @kebincui 2 ปีที่แล้ว

    Thank you so much for sharing, very clear explanation 🌹👍👍

  • @bahadirezici
    @bahadirezici 5 ปีที่แล้ว +6

    God bless you!

  • @Quangnguyen1696
    @Quangnguyen1696 3 ปีที่แล้ว

    Save me from some headaches. Thank you !

  • @shahidurislam4646
    @shahidurislam4646 4 ปีที่แล้ว

    Thank you Sir, easily the best tutorial teacher

  • @AbhishekKumar-vo7wr
    @AbhishekKumar-vo7wr 5 ปีที่แล้ว +1

    Wow. You explain like a G!!! Gang gang. God bless

  • @yahyamlaouhi9508
    @yahyamlaouhi9508 4 ปีที่แล้ว

    man you r hell of a teacher thanks

  • @tusharmehrotra647
    @tusharmehrotra647 2 ปีที่แล้ว

    Great videos, big thanks to venkat!

  • @grreddy2811
    @grreddy2811 2 ปีที่แล้ว

    Nice teacher I have ever seen

  • @cool-as-cucumber
    @cool-as-cucumber 8 ปีที่แล้ว

    Great channel, please keep doing these videos. You are the teacher i never had.

  • @gosmart_always
    @gosmart_always 5 ปีที่แล้ว +1

    Thank you Venkat. You are helping me a lot. Please make a video how we can rollback our database to a given point.

  • @GenerallyGoodMusic
    @GenerallyGoodMusic ปีที่แล้ว

    Thank you, love your videos.

  • @Oxidado86
    @Oxidado86 5 ปีที่แล้ว +1

    me si sirvio bastante, a pesar de estar en ingles , logre enteder la idea del ROW NUMBER . Muchas gracias

  • @ramachandranm4210
    @ramachandranm4210 9 ปีที่แล้ว +1

    nice sir..i watch your ASP and SQL video Series

  • @dawitworku821
    @dawitworku821 5 หลายเดือนก่อน

    Very helpful as usual.

  • @seanm8362
    @seanm8362 4 ปีที่แล้ว

    This is very informative. Thank you so much!

  • @jackfrost8969
    @jackfrost8969 7 หลายเดือนก่อน

    Excellent explanation.

  • @BeingSam7
    @BeingSam7 ปีที่แล้ว

    When we are populating the result set in subquery which is captured within CTE and then we are deleting only from that CTE itself, then how come the original table employee is getting affected?
    I have again watched the part where you have explained CTE but didn't understand this. Could you kindly help.
    Ohh and by the way the whole series is very helpful, KUDOS!! to you Venkat for helping so many people with your great knowledge and impeccable teaching talent!!

  • @mansimishra19
    @mansimishra19 2 ปีที่แล้ว

    Very well explained! Thank you

  • @jitsharma88
    @jitsharma88 ปีที่แล้ว

    thanks . very helpful

  • @brindhaganesan3580
    @brindhaganesan3580 6 ปีที่แล้ว

    Cystal clear explanation!

  • @Toofan2704
    @Toofan2704 4 ปีที่แล้ว

    Very good tutorial Venkat :) thank you

  • @tempura_edward4330
    @tempura_edward4330 3 ปีที่แล้ว

    Great explanation! Thank you

  • @ashrafomer5297
    @ashrafomer5297 5 ปีที่แล้ว

    Thanks Venkat it was well don Tutorial

  • @Archanaarchu-nd3xu
    @Archanaarchu-nd3xu 22 วันที่ผ่านมา

    Whether can v hav row_number as auto increment without repeating. First time if I m executing the select stt i should get 1,2,3 n if I m executing 2nd time i should get 4,5.

  • @angelmeist2652
    @angelmeist2652 ปีที่แล้ว

    can you explain in what order is the male part of the row number assigned after executing the commend... "Tom, Ron, Ben, Todd, Mark, John' does not come as the same order in the original table and it is not in any asc or desc order neither.

  • @karnav43
    @karnav43 2 ปีที่แล้ว

    Hi Venkat, Thanks for these tutorials. One request. Can you create some tutorials on big query? Thanks

  • @peternguyen9382
    @peternguyen9382 ปีที่แล้ว

    Hello Venkat, i dont understand why we delete the data from CTE it delete the data in the real table. I thought the data from CTE is the difference from the table. ?

  • @loayoraby674
    @loayoraby674 6 ปีที่แล้ว

    thanx alot your videos is helping me

  • @Kamil0289
    @Kamil0289 6 ปีที่แล้ว

    very helpful thanks kudvenkat!

  • @DB-sf1hy
    @DB-sf1hy 4 ปีที่แล้ว +1

    How come when you delete from the CTE you also delete from the original table?

  • @Alam_Syed
    @Alam_Syed 5 ปีที่แล้ว +1

    I was looking for this thank you so much

  • @kevinjia1984
    @kevinjia1984 3 ปีที่แล้ว

    Great video, thanks a lot !

  • @jaspreetdandiwal
    @jaspreetdandiwal 6 ปีที่แล้ว

    very good video, flawless

  • @gautamsham7291
    @gautamsham7291 3 ปีที่แล้ว

    Please add plsql tutorial videos as well!

  • @nssramya8792
    @nssramya8792 2 ปีที่แล้ว

    superb sir. I have one doubt how to partition the row_number by alphabetical order sir

  • @20thCenturyFav
    @20thCenturyFav 9 หลายเดือนก่อน

    very well explained, thank you, where's your tip cup lol

  • @NelsonZavala0509
    @NelsonZavala0509 4 ปีที่แล้ว

    Hi it is possible to update all the results send by the row_number with another valure from another table ?

  • @ashutoshhegde7290
    @ashutoshhegde7290 6 ปีที่แล้ว

    thank you Venkat Sir

  • @SinhaFps
    @SinhaFps 4 ปีที่แล้ว

    Great explanation! Thx!

  • @MrPlockey
    @MrPlockey 7 ปีที่แล้ว

    I have seen several of you videos that reference Partition. What does that do?

  • @samirkumar6180
    @samirkumar6180 3 ปีที่แล้ว

    Hello sir, pls make video on table partitioning and their concept...this is something important which is not made yet

  • @dollarmenu9618
    @dollarmenu9618 6 ปีที่แล้ว

    well explained

  • @hungcao1342
    @hungcao1342 2 ปีที่แล้ว

    nice !

  • @venkataashok9460
    @venkataashok9460 2 ปีที่แล้ว

    its maximum row size exceeds the allowed maximum of 8060 bytes. INSERT or UPDATE to this table will fail if the resulting row exceeds the size limit. how to over come this warning

  • @themachine225
    @themachine225 6 ปีที่แล้ว +1

    Hi, thanks for the video, this seems like a very simple function, i have tried it and it seems like its working by its actually returning an empty column, this is my exact code: ROW_NUMBER() OVER (PARTITION BY orddet_nl.invnum ORDER BY orddet_nl.invnum ASC) AS LineReference,
    i dont get any error messages or anything, but it just brings an empty column, any ideas why?
    Thanks

    • @ManishKumar-qx1kh
      @ManishKumar-qx1kh 3 ปีที่แล้ว

      query seems ok can you please post ur sample data so that we can help.

  • @meanmachineYT09
    @meanmachineYT09 6 ปีที่แล้ว

    This helped me a lot, thanks!

  • @dosovi4548bustayes
    @dosovi4548bustayes 9 ปีที่แล้ว +1

    Great

  • @huiqingxu5286
    @huiqingxu5286 5 ปีที่แล้ว

    You are amazing!

  • @evgenyr7127
    @evgenyr7127 6 ปีที่แล้ว

    Great!! Thanks!

  • @JohnWick-zv2mr
    @JohnWick-zv2mr 9 ปีที่แล้ว +1

    thank you very good

  • @chandrakumarreddyvennapusa7806
    @chandrakumarreddyvennapusa7806 4 ปีที่แล้ว

    Fantastic:)

  • @mahendrasinghbaghel3039
    @mahendrasinghbaghel3039 7 ปีที่แล้ว

    can we use one more where clause with row number...?

  • @wasimbader9170
    @wasimbader9170 8 ปีที่แล้ว

    I have sent an email and still waiting for reply. Thumbs up for this video.

  • @leninmishra
    @leninmishra 8 ปีที่แล้ว

    Hi Venkat,
    I have data that has following rows....
    2934046 Kellogg’s Share Your Breakfast 74672 2407522 Kellogg?s Share Your Breakfast ACTIVE 2015-09-01 9999-12-31
    2934046 Kellogg?s Share Your Breakfast 74672 2407522 Kellogg?s Share Your Breakfast ACTIVE 2015-09-01 9999-12-31
    You can see that both rows are the same except for the question mark in the second row. I have to remove such rows from my table. I was trying to use row_number for this, but it doesn't work. Is there any way i can rank such rows based on the characters in my second column...

  • @kartikmondal4933
    @kartikmondal4933 5 ปีที่แล้ว

    Thank u sir.

  • @raqibulAlam-su3jo
    @raqibulAlam-su3jo 9 ปีที่แล้ว +1

    Thanks.

  • @rifaqatullah2379
    @rifaqatullah2379 7 ปีที่แล้ว

    Wonderful

  • @aruneshdillikar4633
    @aruneshdillikar4633 3 ปีที่แล้ว

    what is employee cte is that the table name?

  • @hgoodman9
    @hgoodman9 8 ปีที่แล้ว

    What if you only want to return the row with the max row number?

    • @archrodney
      @archrodney 7 ปีที่แล้ว +1

      -- This query will give you 1 row with the max row number:
      SELECT TOP 1 *, ROW_NUMBER()OVER(PARTITION BY ID ORDER BY ID) AS RowNumber
      FROM Employees
      ORDER BY RowNumber DESC;
      -- This query will give you ALL rows with the max row number:
      WITH RowNumberCTE AS
      (
      SELECT *, ROW_NUMBER()OVER(PARTITION BY ID ORDER BY ID) AS RowNumber FROM Employees
      )
      SELECT * FROM RowNumberCTE WHERE RowNumber =
      (SELECT TOP 1 * FROM (SELECT ROW_NUMBER() OVER (PARTITION BY ID ORDER BY ID) AS RowNumbers FROM Employees) DerivedTable
      ORDER BY RowNumbers DESC)
      -- I know it's not a nice piece of code but it does the job.

    • @hgoodman9
      @hgoodman9 7 ปีที่แล้ว +1

      archrodney thanks

  • @jessejacob1850
    @jessejacob1850 3 ปีที่แล้ว

    I tried it but got an error message saying no column as rownumber

  • @veenitkarkhanis338
    @veenitkarkhanis338 5 ปีที่แล้ว

    Hey guys help me how to find odd rows and even rows

  • @FaeUtero
    @FaeUtero 3 ปีที่แล้ว

    Thanks again for a great tutorial.