Bases de datos
Create Database bd_autos
go
Use bd_autos
go
create table revisiones
(
numero varchar(100) not null primary key,
tipo_revision varchar(20) not null,
matricula_autochar(6) not null,
constraint fk_revisiones_autos foreign key (matricula_auto) references
autos (matricula)
)
Create table autos
(
matricula char(6) not null primary key,
marca varchar(20)not null,
modelo varchar(25) not null,
color varchar(15) null,
precio money null,
)
create table clientes
(
id varchar(15) not null primary key,
nombre varchar(20) not null,
direccionvarchar(30) null,
telefono varchar(20) not null,
ciudad varchar(15) not null,
)
create table detalle_clientes_autos
(
id_cliente varchar(15) not null,
constraint fk_detalle_clientes_autos_clientesforeign key (id_cliente) references clientes(id),
matricula_auto char(6) not null,
constraint fk_detalle_clientes_autos_autos foreign key (matricula_auto) references autos (matricula),
)Create Database bd_empresa
go
use bd_empresa
go
create table clientes
(
id varchar(15) not null primary key,
nombre varchar(15) not null,
direccion varchar(30) not null,
telefonovarchar(15) not null,
apellidos varchar(15) not null,
fecha_nacimiento datetime null,
)
Create table productos
(
codigo varchar(15) not null primary key,
nombre varchar(15) not null,
precio moneynot null,
nit_proveedor varchar(15) not null,
constraint fk_productos_proveedores foreign key (nit_proveedor) references proveedores(nit),
)
Create table proveedores
(
nit varchar(15) not nullprimary key,
Nombre varchar(20) not null,
direccion varchar(30) not null,
telefono varchar(10) not null,
)
Create Table detalle_clientes_proveedores
(
id_cliente varchar(15) not null,constraint fk_detalle_clientes_proveedores_clientes foreign key (id_cliente) references clientes(id ),
id_producto varchar(15) not null,
constraint fk_detalle_clientes_proveedores_productos foreign...
Regístrate para leer el documento completo.