Re: MySQL Checkbox table field

2002-01-25 Thread Vernon A Webb

Alright then!

 database,sql,query,table
 
Which field type do I use for a simply checkbox Y,N?

Thanks



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: MySQL Checkbox table field

2002-01-25 Thread Michael Collins

At 10:58 AM -0500 1/25/02, Vernon A Webb wrote:
   database,sql,query,table

Which field type do I use for a simply checkbox Y,N?

How about CHAR(1)?

-- 
Michael
__
||| Michael Collins   |||
||| Kuwago Web Services   |||  mailto:[EMAIL PROTECTED]
||| Seattle, WA, USA  |||  http://www.lassodev.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: MySQL Checkbox table field

2002-01-25 Thread Todd Williamsen

VarChar Usually



-Original Message-
From: Vernon A Webb [mailto:[EMAIL PROTECTED]] 
Sent: Friday, January 25, 2002 9:58 AM
To: [EMAIL PROTECTED]
Subject: Re: MySQL Checkbox table field


Alright then!

 database,sql,query,table
 
Which field type do I use for a simply checkbox Y,N?

Thanks



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: MySQL Checkbox table field

2002-01-25 Thread Dan Nelson

In the last episode (Jan 25), Michael Collins said:
 At 10:58 AM -0500 1/25/02, Vernon A Webb wrote:
   database,sql,query,table
 
 Which field type do I use for a simply checkbox Y,N?
 
 How about CHAR(1)?

The BIT type seems to be the best fit.  It's currently a synonym for
CHAR(1), but there's a TODO item:

   * Optimise `BIT' type to take 1 bit (now `BIT' takes 1 char).

-- 
Dan Nelson
[EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: MySQL Checkbox table field

2002-01-25 Thread Michael Collins

At 10:49 AM -0600 1/25/02, Dan Nelson wrote:
   Which field type do I use for a simply checkbox Y,N?

The BIT type seems to be the best fit.  It's currently a synonym for
CHAR(1), but there's a TODO item:

* Optimise `BIT' type to take 1 bit (now `BIT' takes 1 char).

Are you thinking MS SQL Server? I am not sure there is a bit type in 
MySQL? Do you mean Char(0)? Anyhow, in MS SQL Server a bit type 
column cannot be indexed so you are better off with CHAR(1).

-- 
Michael
__
||| Michael Collins   |||
||| Kuwago Web Services   |||  mailto:[EMAIL PROTECTED]
||| Seattle, WA, USA  |||  http://www.lassodev.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: MySQL Checkbox table field

2002-01-25 Thread Dan Nelson

In the last episode (Jan 25), Michael Collins said:
 At 10:49 AM -0600 1/25/02, Dan Nelson wrote:
   Which field type do I use for a simply checkbox Y,N?
 
 The BIT type seems to be the best fit.  It's currently a synonym for
 CHAR(1), but there's a TODO item:
 
* Optimise `BIT' type to take 1 bit (now `BIT' takes 1 char).
 
 Are you thinking MS SQL Server? I am not sure there is a bit type in 
 MySQL? Do you mean Char(0)? Anyhow, in MS SQL Server a bit type 
 column cannot be indexed so you are better off with CHAR(1).

Why would the MySQL TODO mention an MS SQL feature? :)

mysql create table test ( myfield bit primary key );
Query OK, 0 rows affected (0.01 sec)

mysql desc test;
+-++--+-+-+---+
| Field   | Type   | Null | Key | Default | Extra |
+-++--+-+-+---+
| myfield | tinyint(1) |  | PRI | 0   |   |
+-++--+-+-+---+
1 row in set (0.88 sec)

OK, so it's actually a synonym for tinyint(1).

-- 
Dan Nelson
[EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: MySQL Checkbox table field

2002-01-25 Thread Michael Collins

At 11:32 AM -0600 1/25/02, Dan Nelson wrote:
Why would the MySQL TODO mention an MS SQL feature? :)


Because the MySQL team wants to add a feature that is found in another DBMS?


OK, so it's actually a synonym for tinyint(1).

I could not find a reference to the synonym in the MySQL 
documentation (in the data type section).

Question remains, can one effectively index tinyint(1)?

Als, back to the original question, in light of bit being equivalent 
to tinyint(1), I suppose storing Y/N is better achieved through the 
use of CHAR(1).

-- 
Michael
__
||| Michael Collins   |||
||| Kuwago Web Services   |||  mailto:[EMAIL PROTECTED]
||| Seattle, WA, USA  |||  http://www.lassodev.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: MySQL Checkbox table field

2002-01-25 Thread Dan Nelson

In the last episode (Jan 25), Michael Collins said:
 At 11:32 AM -0600 1/25/02, Dan Nelson wrote:
 Why would the MySQL TODO mention an MS SQL feature? :)
 
 Because the MySQL team wants to add a feature that is found in
 another DBMS?

According to the Mysql manual, the bit type was added in 3.21.12.
 
 OK, so it's actually a synonym for tinyint(1).
 
 I could not find a reference to the synonym in the MySQL 
 documentation (in the data type section).

Under Column Types (http://www.mysql.com/doc/C/o/Column_types.html):

`BIT' `BOOL' `CHAR'
 These three are synonyms for `CHAR(1)'.
 
 Question remains, can one effectively index tinyint(1)?

You didn't read the message you replied to :)

  mysql create table test ( myfield bit primary key );
  Query OK, 0 rows affected (0.01 sec)
 
  mysql desc test;
  +-++--+-+-+---+
  | Field   | Type   | Null | Key | Default | Extra |
  +-++--+-+-+---+
  | myfield | tinyint(1) |  | PRI | 0   |   |
  +-++--+-+-+---+
  1 row in set (0.88 sec)

Note the describe command shows the field type as tinyint(1), and there
is a primary key on the column.

-- 
Dan Nelson
[EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: MySQL Checkbox table field

2002-01-25 Thread Michael Collins

At 12:02 PM -0600 1/25/02, Dan Nelson wrote:
According to the Mysql manual, the bit type was added in 3.21.12.
`BIT' `BOOL' `CHAR'
  These three are synonyms for `CHAR(1)'.

I see that now in the online docs, I am using the pdf, guess it is 
not as up to date. Sorry if I spoke out of turn.

So why is it that when you add a field with that type you get tinyint(1).

-- 
Michael
__
||| Michael Collins   |||
||| Kuwago Web Services   |||  mailto:[EMAIL PROTECTED]
||| Seattle, WA, USA  |||  http://www.lassodev.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: MySQL Checkbox table field

2002-01-25 Thread James E. Hicks III

I've been using enum (Y,N).

James

-Original Message-
From: Vernon A Webb [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 10:58 AM
To: [EMAIL PROTECTED]
Subject: Re: MySQL Checkbox table field


Alright then!

 database,sql,query,table
 
Which field type do I use for a simply checkbox Y,N?

Thanks




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: MySQL Checkbox table field

2002-01-25 Thread Matthew Walker

This brings to mind a question I've had for a while. Is there any way to
automatically build and update an enum based on another very simple (1
column) table?

Matthew Walker
Ecommerce Project Manager
Mountain Top Herbs


-Original Message-
From: James E. Hicks III [mailto:[EMAIL PROTECTED]] 
Sent: Friday, January 25, 2002 1:45 PM
To: Vernon A Webb; [EMAIL PROTECTED]
Subject: RE: MySQL Checkbox table field

I've been using enum (Y,N).

James

-Original Message-
From: Vernon A Webb [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 10:58 AM
To: [EMAIL PROTECTED]
Subject: Re: MySQL Checkbox table field


Alright then!

 database,sql,query,table
 
Which field type do I use for a simply checkbox Y,N?

Thanks




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
 

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: MySQL Checkbox table field

2002-01-25 Thread Paul DuBois

At 14:04 -0700 1/25/02, Matthew Walker wrote:
This brings to mind a question I've had for a while. Is there any way to
automatically build and update an enum based on another very simple (1
column) table?

What does that mean, exactly?


Matthew Walker
Ecommerce Project Manager
Mountain Top Herbs


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: MySQL Checkbox table field

2002-01-25 Thread David Shields


Alright then!
  database,sql,query,table
Which field type do I use for a simply checkbox Y,N?
Thanks

Any objection to this ?

cbcolumn enum ('Y', 'N') NOT NULL DEFAULT 'Y'

May not be the most space efficient, but its clear, self-documented and 
unambiguous.
It does what it says on the tin.

David.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: MySQL Checkbox table field

2002-01-25 Thread Matthew Walker

Say I have a similar enum field that shows up in many tables. Right now,
if I want to change it, I have to change it everywhere. What I'd like is
a way to have a 1 column table that contains a list of the possible
values for the enum field, and have the enum automatically build itself
based on that table.

Matthew Walker
Ecommerce Project Manager
Mountain Top Herbs


-Original Message-
From: Paul DuBois [mailto:[EMAIL PROTECTED]] 
Sent: Friday, January 25, 2002 2:02 PM
To: Matthew Walker; [EMAIL PROTECTED]
Subject: RE: MySQL Checkbox table field

At 14:04 -0700 1/25/02, Matthew Walker wrote:
This brings to mind a question I've had for a while. Is there any way
to
automatically build and update an enum based on another very simple (1
column) table?

What does that mean, exactly?


Matthew Walker
Ecommerce Project Manager
Mountain Top Herbs



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
 

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php