[thelist] [SQL] selecting info from two tables (?)

rudy rudy937 at rogers.com
Wed Aug 13 06:28:30 CDT 2003

> Am I dreaming, or is this possible

outer joins, as the other paul explained

may i give some hints?

> id int(11) NOT NULL auto_increment PRIMARY KEY,

the (11) is not really necessary -- the number in parentheses is supposed to
be the "maximum display size" but i've yet to see a good example of where
this might be required or even comes in handy

and an int is always stored as an int (four bytes binary)

> userId int(11) NOT NULL default '0',

this bothers me

it shouldn't work, but i know it does, and i blame mysql for perpetuating
the fantastic notion that it's okay to assign a string to a numeric column

> start varchar(20) NOT NULL default '',

i've done this myself on occasion, but it's far better to allow nulls than
to default to an empty string

> stop varchar(20) NOT NULL default '',

are start and stop supposed to be dates?  if so, you would be well advised
to use a datetime datatype

> notified enum('y','n') NOT NULL default 'n',

i'm not thrilled by the enum datatype, and prefer to use char(1)

it's more portable to other database systems, although i realize that this
is rarely a concern for most people

> notified_time varchar(14) NOT NULL default '',

again a datetime or even timestamp datatype would be better

>   org_name tinytext NOT NULL,

another mysql-specific datatype that might be better coded as varchar(255)


More information about the thelist mailing list