MySQL Forums
Forum List  »  Italian

una colonna può avere diversi rifermenti con altre tabelle
Posted by: sukhjinder singh
Date: July 27, 2015 04:32AM

salve,
ho una domanda che riguarda riferimenti, e possibile che una colonna abbia piu riferimenti con altre tabelle cioè sono possibili questi referimenti:
CREATE TABLE `variabile_assocazione_kpi` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_organizzazione` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `variabile_assocazione_kpi_id_organizzazione_variabile_index` (`id_organizzazione`),
CONSTRAINT `variabile_assocazione_kpi_id_organizzazione_livello_gerarchico_fk` FOREIGN KEY (`id_organizzazione`)
REFERENCES `level` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `variabile_assocazione_kpi_id_organizzazione_posizione_aree_fk` FOREIGN KEY (`id_organizzazione`)
REFERENCES `position` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE,
CONSTRAINT `variabile_assocazione_kpi_id_organizzazione_posizione_fk` FOREIGN KEY (`id_organizzazione`)
REFERENCES `aree` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `position` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`descrizione` varchar(11) NOT NULL,
`nome` varchar(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `level` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`descrizione` varchar(11) NOT NULL,
`level_descrizione` varchar(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `aree` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`descrizione` varchar(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Options: ReplyQuote


Subject
Views
Written By
Posted
una colonna può avere diversi rifermenti con altre tabelle
1405
July 27, 2015 04:32AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.