Re: Primary key over 3 columns
| From: | php3 at developersdesk dot com | Date: | Mon, 27 Nov 2000 03:12:17 +0000 |
| Subject: | Re: Primary key over 3 columns | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-4747@lists.php.net to get a copy of this message | ||
Addressed to: "Noah Spitzer-Williams" <noahsw@cyberdude.com>
php-db@lists.php.net
** Reply to note from "Noah Spitzer-Williams" <noahsw@cyberdude.com> Sun, 26 Nov
2000 14:51:45 -0500
>
> I have 3 columns that if you were to append them together would be unique
> for each row in my table. how can i set these 3 together as a primary key
> so i can edit/delete the values in the rows?
>
CREATE TABLE TableName (
Col1 INT NOT NULL,
Col2 VARCHAR(10) NOT NULL,
Col3 VARCHAR(10) NOT NULL,
Col4 WHATEVER,
...
...
PRIMARY KEY( Col1, Col2, Col3 ) );
The NOT NULLs are required on all parts of a key.
Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com