Skip to content

Instantly share code, notes, and snippets.

@faloi
Created November 26, 2014 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faloi/3354d33d034fce725b77 to your computer and use it in GitHub Desktop.
Save faloi/3354d33d034fce725b77 to your computer and use it in GitHub Desktop.
create table Calificacion (
id bigint generated by default as identity (start with 1),
critica varchar(255),
puntaje integer not null,
partidoJugado_id bigint,
primary key (id)
)
create table Equipo1 (
Partido_id bigint not null,
equipo1_id bigint not null
)
create table Equipo2 (
Partido_id bigint not null,
equipo2_id bigint not null
)
create table Participante (
id bigint generated by default as identity (start with 1),
apodo varchar(255),
cantidadPartidosJugados integer not null,
fechaNacimiento varbinary(255),
handicap integer not null,
nombre varchar(255),
promedio double,
partidoActualAjugar_id bigint,
primary key (id)
)
create table Participante_Calificacion (
Participante_id bigint not null,
calificaciones_id bigint not null
)
create table Participante_Participante (
Participante_id bigint not null,
amigos_id bigint not null
)
create table Partido (
id bigint generated by default as identity (start with 1),
primary key (id)
)
create table Partido_Participante (
Partido_id bigint not null,
participantes_id bigint not null
)
alter table Equipo1
add constraint UK_o7xww5plyod2g99907suruhc1 unique (equipo1_id)
alter table Equipo2
add constraint UK_4sxubcij1eabain770cpocynx unique (equipo2_id)
alter table Partido_Participante
add constraint UK_8vcjdbc6080v0a8fgy69girnp unique (participantes_id)
alter table Calificacion
add constraint FK_olsx6elj4fqihk7o6b0n2pban
foreign key (partidoJugado_id)
references Partido
alter table Equipo1
add constraint FK_o7xww5plyod2g99907suruhc1
foreign key (equipo1_id)
references Participante
alter table Equipo1
add constraint FK_1jag129ogw43dqyq0kwn79i1n
foreign key (Partido_id)
references Partido
alter table Equipo2
add constraint FK_4sxubcij1eabain770cpocynx
foreign key (equipo2_id)
references Participante
alter table Equipo2
add constraint FK_tnwdytrqev39yhy76fspi4qv6
foreign key (Partido_id)
references Partido
alter table Participante
add constraint FK_petkt34x521mvr2iv20alxoa
foreign key (partidoActualAjugar_id)
references Partido
alter table Participante_Calificacion
add constraint FK_s88yy2c2sd0ocowa5rth2h8pq
foreign key (calificaciones_id)
references Calificacion
alter table Participante_Calificacion
add constraint FK_gdw1mwtpetj6gc4m8w1wnpten
foreign key (Participante_id)
references Participante
alter table Participante_Participante
add constraint FK_95cq7iqd63k65ti2gi2crl4br
foreign key (amigos_id)
references Participante
alter table Participante_Participante
add constraint FK_ee0y4uh9qniupk578l1am6tb4
foreign key (Participante_id)
references Participante
alter table Partido_Participante
add constraint FK_8vcjdbc6080v0a8fgy69girnp
foreign key (participantes_id)
references Participante
alter table Partido_Participante
add constraint FK_b2pjlh8gdvkv1c6ctknk0m1xj
foreign key (Partido_id)
references Partido
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment