[PHPwestoz] [OT] Relational SQL Databases

Timothy White weirdo at tigris.org
Tue Feb 22 17:32:02 UTC 2005


Nicolas Connault wrote:

> --snip--
>
>>
> This one is easy: "SELECT Songs.* FROM Songs, Albums, Artists WHERE
> Songs.AlbumID = Album.ID AND Album.ArtistID = Artist.ID AND
> Artist.Artist LIKE 'A%' "
>
> I would rename the Artist.Artist field to Artist.Name if I was you,
> it's never good to name a field by the same name as the table.
>
> More helpful?

Very Nice.

Does anybody know of a way to do an INSERT that 'fails' silently if the
entry is already there?
I can just do a select and then an INSERT if the entry isn't there. I
already do a similar thing with SELECT and then INSERT or UPDATE
depending on the result.

Tim

p.s.

> > I then want to do a 'INSERT INTO Artists SET Name=$artist'
> That's not the right syntax. It should be "INSERT INTO Artists
> (`Name`) VALUES ('$artist')"  Check the syntax for these statements in
> the MySQL doc.

I was just reading the manual and I believe this is an alternative
format. I normally use the one you showed. I haven't checked if the
other one work but will as I like the syntax a little better.

--
Tim White - Use the Fox, Luke!
PGP/GPG id: 602E944D, Pub Key Serv: subkeys.pgp.net
Fingerprint: 04C2 9682 B7B2 3006 009D  A9F3 067E EDCD 602E 944D
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!
--

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.linux.org.au/pipermail/phpwestoz/attachments/20050222/a298d9d4/attachment.pgp 


More information about the PHPwestoz mailing list