Hello I made a database based on a project I found on the Internet to do a REST.
The problem I have is that the Primary Key is type varchar
and I can not auto-increment it since Mysql will not let me. I have to do the manual insertion.
How can I manually auto-increment it? I was seeing that with the triggers it could be done but I had no luck.
The tables are these:
Tabla T_Reserva
fechaLlegada: Date
numNoches: integer
numAdultos: integer
numMenDos: integer
numMenDosDoce: integer
localizador: String
observaciones: String
precio: Double
régimen: String
codCliente: String
codHotel: String
tipoHab: String
Clave primaria: localizador
Clave foránea hacia T_Cliente codCliente
Clave foránea hacia T_Hotel codHotel
Clave foránea hacia T_TipHab tipoHab, codHotel
Clave foránea hacia T_Tarifa fechaLlegada, regimen, tipoHab, codHotel
Como clave primaria alternativa tenemos, codigoHotel, codigoCliente,
FechaLlegada, pero de esta manera sólo puede haber un reserva para un cliente en
una fecha determinada.
I should change the Primary Keys to integer
. Because at best he put them as varchar
for some reason.
Thank you.
Tabla T_Cliente
codCliente: String
nombre: String
apellido: String
dirección: String
provincia: String
país: String
código postal: String
teléfono: String
móvil: String
email: String
Clave primaria: codCliente
Tabla T_TarCre
número: String
caducidad: String
tipo: String
codCliente: String
Clave primaria: número
Clave foránea hacia T_Cliente codCliente
Tabla T_Hotel
codigoHotel: String
Nombre: String
fechaMaxEntrada: Date
numMaxNoches : integer
Clave primaria: codHotel
Tabla T_TipHab
tipo: String
numMáxPersonas: integer
disponibilidad: integer
codHotel: String
precio: real
Clave primaria: tipo, codHotel
Clave foránea hacia T_Hotel codHotel
Tabla T_Tarifa
precioNoche: Double
fechaInicio: Date
fechaFin: Date
regimen: String
tarifa: Double
codHotel: String
tipoHab: String
Clave primaria: fechaInicio, regimen, tipoHab, codHotel,
Clave foránea hacia T_TipHab tipoHab, codHotel