RE:modelo entidad relacion de una tienda virtual
create database tienda_cinthya
use tienda_cinthya
create table cliente (
id_cliente int primary key,
nombre varchar (40) not null,
apellido varchar (50) not null,
direccion varchar (50) not null
)
create table vendedor (
id_vendedor int primary key,
nombre varchar (50) not null,
apellido varchar (50) not null,
puesto varchar (50) not null
)
create table articulo (
id_articulo int primary key,
nombre varchar (50) not null,
precio money not null
)
create table proveedor (
id_proveedor int primary key,
nombre varchar (50) not null,
apellido varchar (50) not null
)
create table almacen (
id_articulo int not null,
id_proveedor int not null,
cantidad int not null,
foreign key (id_articulo) references articulo,
foreign key (id_proveedor) references proveedor
)
create table venta (
id_venta int primary key,
id_cliente int not null,
id_vendedor int not null,
fecha datetime not null,
total money not null
foreign key (id_cliente) references cliente,
foreign key (id_vendedor) references vendedor
)
create table detalle_venta(
id_venta int not null,
id_articulo int not null,
cantidad int not null
foreign key (id_venta) references venta,
foreign key (id_articulo) references articulo
)