
# ---------------------------------------------------------------------- #
# Add table "BANCA"                                                      #
# ---------------------------------------------------------------------- #

CREATE TABLE `BANCA` (
    `id_banca` INTEGER NOT NULL AUTO_INCREMENT,
    `id_comune` INTEGER,
    `descrizione` VARCHAR(60),
    `iban` CHAR(27),
    `indirizzo` VARCHAR(60),
    `telefono` VARCHAR(30),
    `email` VARCHAR(30),
    `bic` VARCHAR(30),
    `capZona` VARCHAR(10),
    CONSTRAINT `PK_BANCA` PRIMARY KEY (`id_banca`)
);

# ---------------------------------------------------------------------- #
# Add foreign key constraints                                            #
# ---------------------------------------------------------------------- #

ALTER TABLE `BANCA` ADD CONSTRAINT `COMUNE_BANCA` 
    FOREIGN KEY (`id_comune`) REFERENCES `COMUNE` (`id_comune`);
