Jump to content

MySQL Statements


shane18

Recommended Posts

i think it is better to include it than not to for example if in the future they make it a necessay requirement you will just have to go back and recode everything.

 

I find it a real pain as my keyboard doesn't seem to have the `symbol so i am always copying and pasting it :(

 

 

Link to comment
https://forums.phpfreaks.com/topic/191217-mysql-statements/#findComment-1008221
Share on other sites

what if you have a table called "from"? a statement like "SELECT * FROM from" will not execute. "SELECT * FROM `from`" would work.

 

I doubt it if you can name a table "from", I think "from" is a reserved word in MySQL, therefore your example is not even right to begin with.

 

For the future, if this thing happens in the later versions of MySQL, people won't use it and it will fail because people will stick to the older version because their sites are coded without ` so they are not going to go to each and every SQL statement and add this ` to each and every field and table, this is ridiculous.

 

Even if they did that, then they will be repeating the same mistake with XHTML 1.1 and XTHML 2.0

 

cheers!

Link to comment
https://forums.phpfreaks.com/topic/191217-mysql-statements/#findComment-1008260
Share on other sites

what if you have a table called "from"? a statement like "SELECT * FROM from" will not execute. "SELECT * FROM `from`" would work.

 

I doubt it if you can name a table "from", I think "from" is a reserved word in MySQL, therefore your example is not even right to begin with.

 

Do you doubt this from your extensive knowledge of databases and in particular mysql? Please. Why don't you try it yourself. "create table `from`(test int primary key)". That's exactly why you would use ` because IT IS A RESERVED WORD.

Link to comment
https://forums.phpfreaks.com/topic/191217-mysql-statements/#findComment-1008673
Share on other sites

what if you have a table called "from"? a statement like "SELECT * FROM from" will not execute. "SELECT * FROM `from`" would work.

 

 

I doubt it if you can name a table "from", I think "from" is a reserved word in MySQL, therefore your example is not even right to begin with.

 

Do you doubt this from your extensive knowledge of databases and in particular mysql? Please. Why don't you try it yourself. "create table `from`(test int primary key)". That's exactly why you would use ` because IT IS A RESERVED WORD.

 

 

excuse me, my knowledge is not extensive in SQL, I have not written any SQL statement in ages, however, why would a reasonable programmer give a table such name? a reversed word? don't tell me that he ran out of words lol.

 

This way he is forcing himself to use this ` in each and every statement in his SQL's which sucks.

 

Anyway, you need to take care of millions of web sites that have their SQL's without ` and convience them all to rewrite their code or look for every piece of SQL in their code.

 

good luck for those who want to put ` in their SQL, I promise I won't put any lol, in fact I don't even write SQL's but even if I have to, I won't because its ridiculous. 

Link to comment
https://forums.phpfreaks.com/topic/191217-mysql-statements/#findComment-1008678
Share on other sites

what if you have a table called "from"? a statement like "SELECT * FROM from" will not execute. "SELECT * FROM `from`" would work.

 

 

I doubt it if you can name a table "from", I think "from" is a reserved word in MySQL, therefore your example is not even right to begin with.

 

Do you doubt this from your extensive knowledge of databases and in particular mysql? Please. Why don't you try it yourself. "create table `from`(test int primary key)". That's exactly why you would use ` because IT IS A RESERVED WORD.

 

 

excuse me, my knowledge is not extensive in SQL, I have not written any SQL statement in ages, however, why would a reasonable programmer give a table such name? a reversed word? don't tell me that he ran out of words lol.

 

This way he is forcing himself to use this ` in each and every statement in his SQL's which sucks.

 

Anyway, you need to take care of millions of web sites that have their SQL's without ` and convience them all to rewrite their code or look for every piece of SQL in their code.

 

good luck for those who want to put ` in their SQL, I promise I won't put any lol, in fact I don't even write SQL's but even if I have to, I won't because its ridiculous.

 

It basically only sucks ONCE when you write your application. "from" would seem like a popular table name choice to me, even though i personally wouldn't use it. its also comparable to using {} to mark variables within a PHP string i.e. $mad_lib = "The bread basket was full of {$adjective} bread..." Some people dont do it, or dont like it, but I like it because its easier to pick apart variables just by scanning it quickly. Same with `

Link to comment
https://forums.phpfreaks.com/topic/191217-mysql-statements/#findComment-1008680
Share on other sites

As said before, backticks (``) are used to indicate that given word is a table/column identifier. Using it you can call your tables with reserved words, use whitespace in names or even call your table `.` if you're crazy enough (don't try it at home, I did it for you). For portability reasons (ability to move your application to different database systems) backticks should NOT be used (because (1) they're not part of stadard SQL, and (2) it forces you to give sensible names to your tables/columns)

Link to comment
https://forums.phpfreaks.com/topic/191217-mysql-statements/#findComment-1008694
Share on other sites

For portability reasons (ability to move your application to different database systems) backticks should NOT be used (because (1) they're not part of stadard SQL, and (2) it forces you to give sensible names to your tables/columns)

 

This should be enough for these clumsy backticks to not to be used.

 

I own you one Mchl.

Link to comment
https://forums.phpfreaks.com/topic/191217-mysql-statements/#findComment-1008725
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.