Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE DATABASE AcademiaDeMusica
- GO
- USE AcademiaDeMusica
- GO
- CREATE TABLE musicos(
- dni INT NOT NULL PRIMARY KEY,
- nombre VARCHAR(30) NOT NULL,
- apellido VARCHAR(30) NOT NULL,
- fechaIngreso DATE NOT NULL,
- fechaNacimiento DATE NOT NULL
- );
- CREATE TABLE tiposDeInstrumentos(
- ID_tipoInstrumento SMALLINT NOT NULL PRIMARY KEY IDENTITY(1,1),
- descripcion VARCHAR(30) NOT NULL UNIQUE
- );
- GO
- CREATE TABLE instrumentos(
- ID_instrumento VARCHAR(10) NOT NULL UNIQUE,
- ID_tipoInstrumento SMALLINT NOT NULL FOREIGN KEY REFERENCES tiposDeInstrumentos(ID_tipoInstrumento),
- descripcion VARCHAR(30) NOT NULL UNIQUE
- );
- GO
- CREATE TABLE instrumentosXmusicos(
- dni INT NOT NULL FOREIGN KEY REFERENCES musicos(dni),
- ID_instrumento VARCHAR(10) NOT NULL FOREIGN KEY REFERENCES instrumentos(ID_instrumento),
- PRIMARY KEY(dni, ID_instrumento)
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement