|
I'm trying to create some test SQL tables with foreign key relationships. I have a table entity_platforms defined as create table lg/entity_platforms ( abbreviation for column abbr char(5) not null with default, platform varchar(100) not null with default, primary key(abbreviation) ); And want to define a table entity_platform_categories as create table lg/entity_platform_categories ( abbreviation for column abbr char(10) not null with default, category varchar(100) not null with default, platform_abbreviation for column platabbr char(5) not null with default, primary key(abbreviation), constraint platform_abbreviation_fk foreign key (platform_abbreviation) references lg/entity_platforms (abbreviation) on delete no action on update no action ); When I compile the entity_platform_categories table, I get error SQL0538: Position 1 The FOREIGN key in constraint PLATFORM_ABBREVIATION_FK in LG not same as the parent key. According to the SQL manual, I'm saying that platform_abbreviation in entity_platform_categories is a foreign key pointing to the abbreviation column in the entity_platforms table. Is this correct? (I know, SQL server with the GUI spoiled me.) TIA, Loyd Loyd Goodbar Senior programmer/analyst BorgWarner E/TS Water Valley 662-473-5713
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.