From: Peter Brawley Date: February 21 2006 7:53pm Subject: Re: confused... List-Archive: http://lists.mysql.com/mysql/195030 Message-Id: <43FB6FC8.8020102@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Patrick, >Shouldn't I be getting back a '1' when I do my select??? >Why am I getting an empty set? First, creating a table doesn't add any rows. Show Create Table ... returns a row of data definition info, not a row of table data. Second, Defining the column as NOT NULL will require numeric input for the column, so DEFAULT 1 will have no effect. What are you trying to accomplish with DEFAULT 1? PB ----- Patrick Duda wrote: > 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 > > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 267.15.11/264 - Release Date: 2/17/2006