Baze Novo

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Baze Novo as PDF for free.

More details

  • Words: 321
  • Pages: 3
create table OrganizacionaJedinica ( org_id int not null PRIMARY KEY auto_increment, naziv varchar(50) not null );

create table TipOsobe ( tip_osobe_id int not null primary key auto_increment, naziv varchar(30) not null );

create table TipStatusa ( status_id int not null primary key auto_increment, naziv varchar(35) );

create table Osoba ( osoba_id int not null PRIMARY KEY auto_increment, org_id int, tip_osobe_id int, ime varchar(20) not null, prezime varchar(35) not null, grad varchar(30) not null, post_br int not null, adresa varchar(40) not null, telefon varchar(30), mail varchar(60), status_id int, CONSTRAINT fk_Osoba_org_id FOREIGN KEY (org_id) REFERENCES OrganizacionaJedinica(org_id), CONSTRAINT fk_Osoba_status_id FOREIGN KEY (status_id) REFERENCES TipStatusa(status_id) );

create table Artikal ( sifra_artikla int not null PRIMARY KEY auto_increment, naziv_artikla varchar(50) not null, vrsta_artikla varchar(50), stanje_ulaza int, stanje_izlaza int, cijena double );

create table NarudzbenicaKupca ( narudzbenica_id int not null PRIMARY KEY auto_increment, kupac_id int, datum_narudzbe date, status_id int, CONSTRAINT fk_NaruKupca_kupac_id FOREIGN KEY (kupac_id) REFERENCES Kupac (kupac_id), CONSTRAINT fk_NaruKupca_status_id FOREIGN KEY (status_id) REFERENCES TipStatusa(status_id) );

create table StavkaNarudzbeniceKupca ( sifra_artikla int REFERENCES Artikal (sifra_artikla), narudzbenica_id int REFERENCES NarudzbenicaKupca (narudzbenica_id), naru_kolicina int, PRIMARY KEY (narudzbenica_id, sifra_artikla) );

create table OtpremnicaKupca ( otpremnica_id int not null primary key auto_increment, narudzbenica_id int, skladiste_id int, datum_otpreme date, status_id int, CONSTRAINT fk_OtprKupca_narudzbenica_id FOREIGN KEY (narudzbenica_id) REFERENCES NarudzbenicaKupca(narudzbenica_id), CONSTRAINT fk_OtprKupca_skladiste_id FOREIGN KEY (skladiste_id) REFERENCES Skladiste(skladiste_id), CONSTRAINT fk_OtprKupca_status_id FOREIGN KEY (status_id) REFERENCES TipStatusa(status_id) );

create table Racun ( racun_id int not null PRIMARY KEY auto_increment, otpremnica_id int, datum_izdavanja date, iznos double, CONSTRAINT fk_Racun_kart_id_naru_id FOREIGN KEY (otpremnica_id, narudzbenica_id) REFERENCES OtpremnicaKupca (otpremnica_id, narudzbenica_id) );

create table Skladiste ( skladiste_id int not null PRIMARY KEY auto_increment, org_id int, naziv varchar(40), grad varchar(30), CONSTRAINT fk_Skladiste_org_id FOREIGN KEY (org_id) REFERENCES OrganizacionaJedinica (org_id) );

create table Dobavljac ( dobavljac_id int not null PRIMARY KEY auto_increment, naziv varchar(40), grad varchar(30), adresa varchar(35), status_id int, CONSTRAINT fk_Dobavljac_status_id FOREIGN KEY (status_id) REFERENCES TipStatusa(status_id) );

create table DobavljacArtikal ( artikal_id int REFERENCES Artikal (artikal_id), dobavljac_id int REFERENCES Dobavljac (dobavljac_id), PRIMARY KEY (dobavljac_id, artikal_id) );

Related Documents

Baze Novo
June 2020 9
Baze
November 2019 23
Novo
June 2020 22
Novo
November 2019 34
Novo
November 2019 50
Novo
October 2019 53