On Thu, Sep 11, 2008 at 12:19:44PM +0200, Gilles Ganault scratched on the wall:

> So I guess a NULL is different from a column that was never set to
> anything when creating the record?

  There is no such thing as "a column that was never set to anything."
  You might not explicitly set a value, but something is always
  recorded into the record.

> Here's an example:
> ======
> //Leave col2 empty instead of NULL
> $sql = "INSERT INTO mytable (id,col1) VALUES (NULL,?)";
> $insert = $dbh->prepare($sql);
> $insert->execute(array($argv[1]));
> ======

  In this case, "id" will have a NULL assignment (even if it has a
  non-NULL default value) and "col2" will be assigned its default value.

  All columns have a default value.  You can associate an explicit
  default value to a column when you create the table.  Otherwise, the
  default value is assumed to be NULL.


  A NULL assignment is SQL's way of representing an undefined/unknown
  value.  This is a bit different than the way many popular scripting
  languages use an "undef" value or the way that C/C++ uses NULL.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"'People who live in bamboo houses should not throw pandas.' Jesus said that."
   - "The Ninja", www.AskANinja.com, "Special Delivery 10: Pop!Tech 2006"
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to