Query Command for linked list

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
szms
Forum Contributor
Posts: 101
Joined: Thu Jun 26, 2003 12:23 pm

Query Command for linked list

Post by szms »

Query Command for linked list
I am working on a data base and using mysql. The following three tables are being used and want find the Name of the Domain from the Domain List which are equivalent. Like to inform you that a linked list conception is being used in the Table DomainEquivalentList. Could you please give some clue for the query command. Thank you.


CREATE TABLE Domain
(
INDEX (Domain_ID),
Domain_ID MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
UNIQUE (Name),
Name VARCHAR(255) NOT NULL,
Description BLOB NOT NULL,
PRIMARY KEY (Domain_ID)
) TYPE = INNODB;

CREATE TABLE DomainEquivalentList
(
INDEX (DomainEquivalentList_ID),
DomainEquivalentList_ID MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
INDEX (Domain_ID),
Domain_ID MEDIUMINT UNSIGNED NOT NULL,
INDEX (Next_ID),
Next_ID MEDIUMINT UNSIGNED,
FOREIGN KEY (Domain_ID) REFERENCES Domain (Domain_ID) ON DELETE CASCADE,
FOREIGN KEY (Next_ID) REFERENCES DomainEquivalentList (DomainEquivalentList_ID) ON DELETE CASCADE,
PRIMARY KEY (DomainEquivalentList_ID)
) TYPE = INNODB;


CREATE TABLE DomainEquivalence
(
DomainEquivalence_ID MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
UNIQUE (Name),
Name VARCHAR(255) NOT NULL,
Description BLOB NOT NULL,
INDEX (First),
First MEDIUMINT UNSIGNED,
FOREIGN KEY (First) REFERENCES DomainEquivalentList (DomainEquivalentList_ID) ON DELETE CASCADE,
PRIMARY KEY (DomainEquivalence_ID)
) TYPE = INNODB;
Post Reply