Está en la página 1de 5

1.

FABRICA DE PELOTAS “GOLAZO”

-- Created by Vertabelo (http://vertabelo.com)

-- Last modification date: 2020-01-08 17:13:12.786

-- tables

-- Table: Maquinas

CREATE TABLE Maquinas (

marca varchar(15) NOT NULL,

model varchar(30) NOT NULL,

num serial NOT NULL,

Plantas_superf decimal(6,1) NOT NULL,

CONSTRAINT Maquinas_pk PRIMARY KEY (marca)

);

-- Table: Plantas

CREATE TABLE Plantas (

superf decimal(6,1) NOT NULL,

Procesos_nombre varchar(20) NOT NULL,

CONSTRAINT Plantas_pk PRIMARY KEY (superf)

);
-- Table: Procesos

CREATE TABLE Procesos (

nombre varchar(20) NOT NULL,

complej int NOT NULL,

CONSTRAINT Procesos_pk PRIMARY KEY (nombre)

);

-- Table: Tecnicos

CREATE TABLE Tecnicos (

DNI serial NOT NULL,

nombre varchar(50) NOT NULL,

apellido varchar(50) NOT NULL,

fecnac date NOT NULL,

contact serial NOT NULL,

turno time NOT NULL,

Plantas_superf decimal(6,1) NOT NULL,

CONSTRAINT Tecnicos_pk PRIMARY KEY (DNI)

);
-- Table: maqui_tec

CREATE TABLE maqui_tec (

Maquinas_marca varchar(15) NOT NULL,

Tecnicos_DNI serial NOT NULL,

CONSTRAINT maqui_tec_pk PRIMARY KEY (Maquinas_marca)

);

-- foreign keys

-- Reference: Maquinas_Plantas (table: Maquinas)

ALTER TABLE Maquinas ADD CONSTRAINT Maquinas_Plantas FOREIGN

KEY Maquinas_Plantas (Plantas_superf)

REFERENCES Plantas (superf);

-- Reference: Plantas_Procesos (table: Plantas)

ALTER TABLE Plantas ADD CONSTRAINT Plantas_Procesos FOREIGN KEY

Plantas_Procesos (Procesos_nombre)

REFERENCES Procesos (nombre);

-- Reference: Table_6_Maquinas (table: maqui_tec)


ALTER TABLE maqui_tec ADD CONSTRAINT Table_6_Maquinas FOREIGN

KEY Table_6_Maquinas (Maquinas_marca)

REFERENCES Maquinas (marca);

-- Reference: Table_6_Tecnicos (table: maqui_tec)

ALTER TABLE maqui_tec ADD CONSTRAINT Table_6_Tecnicos FOREIGN

KEY Table_6_Tecnicos (Tecnicos_DNI)

REFERENCES Tecnicos (DNI);

-- Reference: Tecnicos_Plantas (table: Tecnicos)

ALTER TABLE Tecnicos ADD CONSTRAINT Tecnicos_Plantas FOREIGN KEY

Tecnicos_Plantas (Plantas_superf)

REFERENCES Plantas (superf);

-- End of file.

También podría gustarte