List:General Discussion« Previous MessageNext Message »
From:Patrick Duda Date:February 21 2006 7:39pm
Subject:confused...
View as plain text  
Why, when I create a table as follows:

mysql> create table requestid (     request_id int not null default 
1,     constraint requestid_innodb_pk_cons primary key(request_id) ) 
ENGINE=InnoDB;
Query OK, 0 rows affected (0.02 sec)


Do I get the following?

mysql> select request_id from requestid;
Empty set (0.01 sec)

When I do a show create table I see:

mysql> show create table requestid;
+-----------+----------------------------------------------------------------------------------------------------------------------------------------------+
| Table     | Create 
Table 
|
+-----------+----------------------------------------------------------------------------------------------------------------------------------------------+
| requestid | CREATE TABLE `requestid` (
   `request_id` int(11) NOT NULL default '1',
   PRIMARY KEY  (`request_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-----------+----------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Shouldn't I be getting back a '1' when I do my select???  Why am I getting 
an empty set?  What am I not understanding?  How do I create a table with a 
starting value of '1' or '0' for an int???

Thanks

Thread
confused...Patrick Duda21 Feb
  • Re: confused...Hugh Sasse21 Feb
  • Re: confused...SGreen21 Feb
  • Re: confused...Peter Brawley21 Feb