MySQL Forums
Forum List  »  Spanish

Re: ¿Manera más óptima de guardar valores en base de datos?
Posted by: Jesús Uzcanga
Date: November 05, 2013 05:10PM

No Victor.

El deber ser es que crees una tablas principales como:

usuarios
colorojos
gustos
etc

Y las subtablas establecerá las relaciones entre ellas.

Ejemplo solo para personas y gustos:

Tabla usuarios
id | Nombre
-------------
1 | Jesús
2 | María
3 | José


Tabla Gustos
id | Gusto
-------------
11 | Baloncesto
22 | Futbol
33 | Surf
44 | Programar
55 | Sexo
66 | Cine


Tabla RelacionGusto
id_Persona | Id_Gusto
-----------------------
1 | 11
1 | 22
1 | 55
1 | 66
2 | 11
2 | 55
3 | 55
3 | 66

Al hacer la consulta solo debes relacionar las tablas entre sí para mostrar el nombre del usuario y el nombre del gusto

___________________________
Ing. Jesús Alfredo Uzcanga
Twitter: @JesusUzcanga

We learn the 20% of what we HEAR,
the 50% of what we SEE,
the 80% of what we DO and
the 95% of what we TEACH.

____________________________________________________________
https://www.linkedin.com/in/jauzcanga/

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: ¿Manera más óptima de guardar valores en base de datos?
1240
November 05, 2013 05:10PM
921
November 05, 2013 05:42PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.