List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 18 2003 5:14pm
Subject:Re: Column names
View as plain text  
At 15:21 +0200 1/18/03, Octavian Rasnita wrote:
>But I know that the _ character is used as a wildcard for any single
>character.
>wouldn't it be considered it as a wild card when using it  in a column name?

Depends on the context.  If you issue a

SHOW COLUMNS FROM mytable LIKE 'my_col'

statement, then 'my_col' will match my_col, but also myxcol, my0col, etc.
You need to write it like

SHOW COLUMNS FROM mytable LIKE 'my\_col'

to match my_col *only*.

But in the context of other statements that do not interpret a name
as a pattern, _ won't be taken as a wildcard.

>
>Teddy,
>Teddy's Center: http://teddy.fcc.ro/
>Email: orasnita@stripped
>
>----- Original Message -----
>From: "Keith C. Ivey" <keith@stripped>
>To: "MySQL" <mysql@stripped>
>Cc: "Octavian Rasnita" <orasnita@stripped>
>Sent: Friday, January 17, 2003 8:31 PM
>Subject: Re: Column names
>
>
>On 17 Jan 2003, at 16:40, Octavian Rasnita wrote:
>
>>  In MySQL I know that I need to put the column names between `` in some
>>  cases if they contain a % or an _ sign in it. Please tell me what sign
>>  can I use to link 2 words in a column without needing to include that
>>  column name between ``.
>>
>>  Can I use a - (dash) sign, or it might be considered in some cases a
>>  minus operator?
>
>You shouldn't need `` around column names that contain _.  Underscore
>is pretty standard for separating words in a name.
>
>With dash, you'd have to use ``, because - is the minus operator.
>
>[Filter fodder: SQL]
>
>--
>Keith C. Ivey <keith@stripped>
>Tobacco Documents Online
>http://tobaccodocuments.org
>Phone 202-667-6653

Thread
Column namesOctavian Rasnita17 Jan
  • RE: Column namesJennifer Goodie17 Jan
  • Re: Column namesKeith C. Ivey17 Jan
    • Re: Column namesOctavian Rasnita18 Jan
      • Re: Column namesPaul DuBois18 Jan