MySQL issue
#1

my question is, when and when not to use in a query the symbol ` `

and

what is the / and when and when not to use ORDER BY and the LIMIT in a query
Reply
#2

You use the accents when you are not sure if your table name or column name is a MYSQL Reserved word

ORDER BY: Sets the order of the items sorted alphabetically (so: mamoru comes before Zen in a ORDER BY ASC)
LIMIT: Limits the number of records returned (eg: SELECT * FROM users LIMIT 0,10 gets the first 10 users in the table)
Reply
#3

Quote:
Originally Posted by mamorunl
Посмотреть сообщение
You use the accents when you are not sure if your table name or column name is a MYSQL Reserved word

ORDER BY: Sets the order of the items sorted alphabetically (so: mamoru comes before Zen in a ORDER BY ASC)
LIMIT: Limits the number of records returned (eg: SELECT * FROM users LIMIT 0,10 gets the first 10 users in the table)
OK, thanks

i don't understand the accents... explain more
Reply
#4

http://forum.sa-mp.com/showthread.ph...=mysql+keyword
Reply
#5

Quote:
Originally Posted by Speed++
Посмотреть сообщение
OK, thanks

i don't understand the accents... explain more
Vince has posted a nice thread, but to put it in short: you put an accent to the column or table name if you are not sure if it is a mysql keyword (or reserved word). These are words that you put into your query to get the result you want: SELECT, IN, IS, NOT, WHERE, HAVING, etc. If you do want these as a table name (which I had in a project once, which were IS-parts) you have to 'escape' the table names with those back ticks. So:

SELECT * FROM `IS` WHERE 1=1

SELECT * FROM IS WHERE 1=1 will give an error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)