Facebook – https://www.facebook.com/TheNewBoston-464114846956315/ GitHub – https://github.com/buckyroberts Google+ …
Original source
Facebook – https://www.facebook.com/TheNewBoston-464114846956315/ GitHub – https://github.com/buckyroberts Google+ …
Original source
43 responses to “MySQL Database Tutorial – 7 – DISTINCT and LIMIT”
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.
How to compare two column value in same table
Its not working for me
Place of 'distinct' why we will not take 'group by' sir
very well explained
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!
I love how Harry Potter is your customer 3:30 🙂
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?
"Okay just gimme an hour" , types in command in 4 seconds haha
THIS IS AN INCREDIBLY VALUABLE THING.
Thank you!
Thnx bro
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 🙁
I'm using oracle database 11g and the limit keyword is is not being executed in it…it's showing me an error
so how can i get the last value then…?
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
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… 😛
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
lol treehouse is gonna help that ad come every single time
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.
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
#DisrespectYourBoss with Bucky Roberts😂
how do we combine mysql with php codes ? I mean how we do combine with index.php ?
One hour haha and used it for extended break
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
hi bucky how to comment on your tnb form i don't knew can you help me plz??
if pc starts from 0 then it must starts from 4 or 5 but it starts from 6 🙁 but than god u explain limit
you have the talent to make the most painfully boring stuff, intresting!
<3
You are smart and funny.. that's sexy <3
thank you very much!
I hope this comment gets more than 3 like
lmao…hallarious tutorials. the most useful too
These IT jokes are hilarious
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!
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.
430 Likes, 0 Dislikes 🙂 Deservedly so!
Thanks a lot, I like your tutorial 🙂
Okay, i laughed a bit! Thanks for tutorials. I'm sure to check you'r forums too 🙂
haha you're so awesome
5 Harry Potter 😀
My boys would call me Bucky?
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
the wild card statement has he said is useful in a UNIX terminal example
cd /home/yu*/bots
/home/yuri/bots~#