2007/7/19, PaulCheung <[EMAIL PROTECTED]>:

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
[EMAIL PROTECTED]
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to