+ 5
Are the two codes below the same ?
SELECT * FROM customers WHERE ID BETWEEN 3 AND 7; SELECT ID FROM customers LIMIT 2,5;
10 odpowiedzi
+ 2
what if the first query is changed to
SELECT ID FROM customers
WHERE ID BETWEEN 3 AND 7;
+ 1
No they are not.
The first returns all the columns where ID is between 3 and 7.
The secound returns only the ID column.
+ 1
but are they the same?
+ 1
Ulisses Cruz
you are confusing the limit section
its asking values of id 5 rows starting from 3
+ 1
They are not same as the I'd data in the table may not be present in ascending order. so both synatax will give you different results.
0
They are not the same!
In the first you are asking values of ID from 3 to 7.
In the second you are asking values of ID, but only 2 rows starting from 5th row.
0
Not the same.
First return all columns from the fourth ,end with the 7th.
The second returns the column named ID,from the 3rd,end with the 7th
0
thanks to everyone
0
No, the codes posted below are not the same. The difference in the 2 are as follows:
Code #1 Would return every/all columns between ID 3 & 7 .
Code #2 Would only return the "ID".