[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SQL inserts
Jason Pincin wrote:
> Also, if you want to get an up-to-the-second detail on the DB's, you can
> hit http://admin.linuxkb.org/sqladmin/ and login with your user & passwd
> account for the DB, and then bring up the linuxkb database, and click on
> 'Properties' for whichever table your curious about.
OK, that's cool.
> > insert into Users set EmailAddr='lyoder@cyberis.net', FakeEmailAddr='',
> > Passwd=PASSWORD('passwd'), CookieMethod=0, Fname='Bozo', Lname='the
> > Clown', MI='', Handle='bozo', UserDesc='', RoleID=1, QperDay=NULL,
> > Href='http://', InceptTime=NOW(), Expiration='1999-22-3 21:22:53'
>
> Shouldn't the 'set' operative only be used with an UPDATE statement? I
> would try re-phrasing that statement as something like this:
>
> insert into Users
> values(NULL,'lyoder@cyberis.net','',PASSWORD('passwd'),0,'Bozo','the
> Clown', '', 'bozo', '', 1, 0, 0, 'http://', NOW(), '1999-22-3 21:22:53',
> NULL)
>
> That last NULL is important as it triggers mysql to timestamp the entry
> properly.
I read in the MySQL manual that it supports the set syntax. Anyway, I
think that's the best way to do it, because it's easier to read and if
we change the order of columns in the table, or add or delete something,
it will be MUCH easier to fix things.