[thelist] SQL basic questions

rudy r937 at interlog.com
Mon Jan 21 22:05:28 CST 2002


>> another difference is that you have to insert NULLs into them
>
>Sorry I think you mean you _can't_ insert nulls into them.

nope, according to the mysql doc,

   "An integer column may have the additional attribute
    AUTO_INCREMENT. When you insert a value of NULL
    (recommended) or 0 into an AUTO_INCREMENT column,
    the column is set to value+1, where value is the largest value
    for the column currently in the table. AUTO_INCREMENT
    sequences begin with 1."

so an example would be

    create table foo
      ( fookey int not null auto_increment
      , foodata varchar(20) null)

    insert into foo (fookey, foodata)
         values (null, 'bar')


> I also thought that I should mention that its generally not a good
practice
> to be creating tables on the fly like this

quite true

that's more or less what i meant by "making it harder than it is"

handling dynamic data definition statements on the fly is not the sort of
app to be building if you're just getting to know a particluar database


rudy






More information about the thelist mailing list