-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathbase_de_datos.sql
More file actions
88 lines (74 loc) · 2.11 KB
/
base_de_datos.sql
File metadata and controls
88 lines (74 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
create database pos;
use pos;
create table categorias(
id bigint unsigned primary key auto_increment,
nombreCategoria varchar(50) not null
);
create table marcas(
id bigint unsigned primary key auto_increment,
nombreMarca varchar(50) not null
);
create table productos(
id bigint unsigned primary key auto_increment,
codigo varchar(50) not null,
nombre varchar(255) not null,
precioCompra decimal(8,2) not null,
precioVenta decimal(8,2) not null,
existencia int not null,
vendidoMayoreo boolean,
precioMayoreo decimal(8,2),
cantidadMayoreo decimal(8,2),
marca bigint unsigned,
categoria bigint unsigned
);
create table clientes(
id bigint unsigned primary key auto_increment,
nombre varchar(100) not null,
telefono varchar(20)
);
create table usuarios(
id bigint unsigned primary key auto_increment,
usuario varchar(50) not null,
nombre varchar(100) not null,
telefono varchar(20) not null,
password varchar(255) not null
);
create table ventas(
id bigint unsigned primary key auto_increment,
fecha datetime not null,
total decimal(9,2) not null,
pagado decimal(9,2) not null,
idCliente bigint,
idUsuario bigint not null
);
create table cuentas_apartados(
id bigint unsigned primary key auto_increment,
fecha datetime not null,
total decimal(9,2) not null,
pagado decimal(9,2) not null,
porPagar decimal(9,2) not null,
tipo enum('apartado', 'cuenta') not null,
idCliente bigint,
idUsuario bigint not null
);
create table productos_vendidos(
id bigint unsigned primary key auto_increment,
cantidad decimal(5,2) not null,
precio decimal(8,2) not null,
idProducto bigint not null,
idReferencia bigint not null,
tipo enum('apartado', 'cuenta', 'venta') not null
);
alter table productos_vendidos modify tipo enum('apartado','cuenta', 'venta', 'cotiza');
create table cotizaciones(
id bigint unsigned primary key auto_increment,
fecha datetime not null,
total decimal(9,2) not null,
idCliente bigint,
idUsuario bigint not null
);
create table configuracion(
nombre varchar(255),
telefono varchar(20),
logo varchar(255)
);