MySQL Database Tutorial – 7 – DISTINCT and LIMIT

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

43 responses to “MySQL Database Tutorial – 7 – DISTINCT and LIMIT”

  1. Adrian H. Avatar

    If LIMIT 5, 10 is showing the first 10 examples try using LIMIT 5 OFFSET 5 for example to get the same results.

  2. Johnny Rouddro Avatar

    In case anyone's wondering how to get the last 10 results. just LIMIT 0, 10 and sort it in descending order with DESC. tutorial 8 and 9 will get you there.

  3. Women Empowerment Avatar

    How to compare two column value in same table

  4. Ptmp727 Avatar

    Its not working for me

  5. Special Talent Avatar

    Place of 'distinct' why we will not take 'group by' sir

  6. swingga Avatar

    very well explained

  7. Tayyab Mazhar Avatar

    LIMIT 5 is same as LIMIT 0,5. Which means to start from 'INDEX 0' which is 'ID 1', and retrieve five rows (id 1,2,3,4,5).
    Similarly, 'LIMIT 5,10' means to start from 'INDEX 5' which is 'ID 6', and retrieve 10 rows meaning –> ID 6,7,8,9,10,11,12,13,14,15.
    SIMPLE!

  8. Yavor Kirov Avatar

    I love how Harry Potter is your customer 3:30 🙂

  9. gopal Avatar

    Limit 5 is used because we used 1,2,3,4… As id which was our primary key? What if our id is our primary key but instead of 1,2,3… i used 87FUP as the id? How am i now going to put the limit?

  10. Ke W Avatar

    "Okay just gimme an hour" , types in command in 4 seconds haha

  11. Vaughn Johnson Avatar

    THIS IS AN INCREDIBLY VALUABLE THING.

  12. Akira Eddison Avatar

    hi! what if i wanted to put the first 5 on section A, and started from 1-10 on section B , i dont know where I can adjust this 🙁

  13. Gaurang Datt Avatar

    I'm using oracle database 11g and the limit keyword is is not being executed in it…it's showing me an error

  14. Suraj Bobade Avatar

    so how can i get the last value then…?

  15. TheSpaceninjas Avatar

    Like your vids, very good way to teach something that's actually pretty simple when you wrap your head around it compared to other aspects of coding. I'd like to point out that limit does not work inherently with Microsoft SQL Server. You need to write the query something like this:

    SELECT TOP 10 property_id, device_id, name FROM device_property ORDER BY property_id DESC

    or like this

    SELECT property_id, device_id, name FROM device_property ORDER BY property_id OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY

  16. Jayesh Motwani Avatar

    hey buddy let me tell you, your teaching way is awesome. The way you crack the jokes in between are damn too awesome. Still laughing… 😛

  17. Panagiwths Makropoulos Avatar

    i think u should mention the fact that when we write LIMIT 5 (only 1 number) it will show the first 5 ids-names although it starts counting from 0. If it was starting counting from 0, wouldn't it show 6 ids-names(?). 0->1(1ist id) 1->2(2nd id) …… 5(LIMIT)->6(6th id) but that's not what happening

  18. Pc GamingHD Avatar

    lol treehouse is gonna help that ad come every single time

  19. In Bota Avatar

    You made a mistake explaining the query with two numbers.
    First number isn't the starting point but the number of rows that will be trimmed from the results (starting from 1, not zero because NULL is ignored, because it seem like you don't have it).
    It does start counting from zero, but in that case, the first displayed number would be 5, not 6.
    Counting with zero: 0, 1, 2, 3, 4 – these would be trimmed and the list would start from 5.

  20. FAHAD MOHAMMAD Avatar

    Hey can some1 help me out with this:
    What if I wanted to know how many customers are from each state ???
    will this do ???
    SELECT COUNT(state)
    FROM customers
    GROUP BY state

  21. Özer Çevikaslan Avatar

    how do we combine mysql with php codes ? I mean how we do combine with index.php ?

  22. Wiz Enz Avatar

    One hour haha and used it for extended break

  23. Declan Marks Avatar

    Bad database practive. None of your data is normalised. For name you put the whole name in one column. First name and second name should have been put in separate columns

  24. Majestic Barrack Avatar

    hi bucky how to comment on your tnb form i don't knew can you help me plz??

  25. Majestic Barrack Avatar

    if pc starts from 0 then it must starts from 4 or 5 but it starts from 6 🙁 but than god u explain limit

  26. Proper Sag Avatar

    you have the talent to make the most painfully boring stuff, intresting!
    <3

  27. Faizah Alkatheri Avatar

    You are smart and funny.. that's sexy <3

  28. Summer Lee Avatar

    thank you very much!

  29. ►►► FireBoy2708 ◄◄◄ Avatar

    I hope this comment gets more than 3 like

  30. John Smith Avatar

    lmao…hallarious tutorials. the most useful too

  31. Gary Lee Avatar

    These IT jokes are hilarious

  32. Troy Najera Avatar

    For anyone confused about the numbering of the LIMIT keyword with multiple values, read this:

    Bucky is right when he says that the index count starts at 0. By index count, I mean that the very first row in the column has an index of 0. 

    Where people are getting confused is the fact that the IDs start at 1. Look below for explanation:

    index 0       id 1
    index 1       id 2
    index 2       id 3
    index 3       id 4
    index 4       id 5
    index 5       id 6

    index 14     id 15

    So when you type LIMIT 5, 10  the 5 is referring to the index of 5, meaning it will start by showing id 6. The 10 is referring to how many total rows will be displayed, which is why it only goes up to index of 14 because that's a total of 10 rows if you include the index of 5.

    Hope this helps!

  33. John Anderson Avatar

    Correct me if I'm wrong but Limit 5,10 should start at 4 if using 0 as the first number, not 6 (0,1, 2, 3, 4 = 5) It appears that LIMIT 5,10 means 10 people after the first 5 IDs (6). If your key started at 100 then LIMIT 5, 10 would start at id 105 (bypassing 100, 101, 102, 103, 104) a small mistake in a great sea of video.

  34. Bob Bobby Avatar

    430 Likes, 0 Dislikes 🙂 Deservedly so!

  35. Nourah Bin Hussain Avatar

    Thanks a lot, I like your tutorial 🙂

  36. Kampinator Avatar

    Okay, i laughed a bit! Thanks for tutorials. I'm sure to check you'r forums too 🙂

  37. DeadKatBounce Avatar

    haha you're so awesome

  38. 0wasserfall Avatar

    5 Harry Potter 😀

  39. TTV5 Avatar

    My boys would call me Bucky?

  40. Yuri konichiwa Avatar

    or sudo apt-get install php5-c*rl
    it will look for any package with the latters "php5-crl" it will fill in the missing letters based on what you gave it say you wonna rome all files with the mp3 ext you will run rm *.mp3

  41. Yuri konichiwa Avatar

    the wild card statement has he said is useful in a UNIX terminal example
    cd /home/yu*/bots
    /home/yuri/bots~#

Leave a Reply

Your email address will not be published. Required fields are marked *