[nycphp-talk] Primary keys
Дмитрий Ананьев
d.ananyev at gmail.com
Thu Jul 19 08:36:14 EDT 2007
2007/7/19, PaulCheung <paulcheung at tiscali.co.uk>:
>
> I want to set up primary keys made up of several fields. Referring to the
> COBOL type example below is it possible to set up group data structures as
> illustrated by ACCOUNT and NAME?
>
>
>
> 01 EXAMPLE-RECORD. SYNC.
>
> 05 ACCOUNT.
>
> 10 BRANCH PIC 9(6).
>
> 10 ACCOUNT-NO PIC 9(8).
>
> 10 PIN PIC 9(4).
>
> 05 BALANCE PIC S9(6)v99 COMP-3
>
> 05 NAME.
>
> 10 GIVEN PIC X(25).
>
> 10 SURNAME PIC X(30).
>
> 05 FILLER PIC X(40).
>
>
>
> This way I could use ACCOUNT as a primary key or if I so wished I could
> concatenate NAME and ACCOUNT and use that as primary key. Can concatenated
> fields be used as a primary key?
Hi, Paul
A PRIMARY KEY can be a multiple-column index. However, you cannot create a
> multiple-column index using the PRIMARY KEY key attribute in a column
> specification. Doing so only marks that single column as primary. You must
> use a separate PRIMARY KEY(*index_col_name*, ...) clause.
>
http://dev.mysql.com/doc/refman/5.1/en/create-table.html
--
WBR, Dmitry Ananyev
d.ananyev at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070719/6e497537/attachment.html>
More information about the talk
mailing list