e.g. query is
SELECT `username`, `uid`,`email` from profile and `id`='0';
and
SELECT username, uid,email from profile and id='0';
both will yeild same result. so why we should use or not use ` in mysql query.
e.g. query is
SELECT `username`, `uid`,`email` from profile and `id`='0';
and
SELECT username, uid,email from profile and id='0';
both will yeild same result. so why we should use or not use ` in mysql query.
The backtick and nonbacktick versions that you show both do the same thing.
The main reason one would use backticks is to escapse a MySQL reserved word or a column with a space in the column name.
You can name your columns anything if you use `
to delimit them. You could call it timestamp
, restrict
or any other keyword. Or you could call it 60000
. Or you could call it domain of the flying spaghetti monster
if you really wanted.
SELECT `domain of the flying spaghetti monster` FROM `table`
has to be the weirdest select query I've seen!
Backticks will allow you use mysql reserved words as column names. Which is not a good idea to use anyways.
Example:
SELECT from, insert,delete from profile and `id`='0'; will not work
SELECT `from`, `insert`,`delete` from profile and `id`='0'; will work