Relate 3 tables for java project

0

I have a question about mysql + java , I'm doing a project that I need to use 3 tables, and use methods to call data in common, but I do not know how to do them in a way in which the 3 are related to make the queries.

Since I need a customer table with data from a customer, a parking lot and a boucher, that is, register a customer and add the parking lot in which I park your car, then search with the customer's RUT to list all the parking that I do with your ticket number and amount, then generate a boucher or ticket with parking data (name, ticket number and amount to pay) and option to send the boucher that is a customer data (shipping method ), here I have more but what I thought, but I do not know how to join them ...

* this is the beginning with the name and all that

create database clienteDB;

use clienteDB;
  • Here is all the customer data

create table clientes(
    id int auto_increment,
    nombre varchar(50),
    apellido varchar(50),
    correo varchar(50),
    formaPago varchar(50),
    formaBoleta varchar(50),
    telefono int(10),
    rut varchar(10),  
    primary key(id),
    unique(rut),
    unique(numeroTicket)
);

* here I need the way that with the rut, rescue the data of how many records the user entered the parking 1 or more

create table estacionamientos(
    idEsta int auto_increment,
    nombreEstacionamiento varchar(50),
    numeroTicket int(5),
    precioEstacionamiento int(10), 
    primary key(idEsta),
    unique(numeroTicket)
);

* here I need that apart generate the boucher with your boucher number, show the parking data and the shipping option that the customer requested

create table boucher(
    idBoucher int auto_increment,    
    numeroBoucher int(5),    
    primary key(idBoucher ),
    unique(numeroBoucher )
);

that's more or less what I have in mind, but I only found ways to do it with mysql admin and I need to create the script with the tables, I hope it was clear, thank you very much for the help

    
asked by Jordan Blake Told 08.12.2017 в 21:06
source

0 answers