Este tipo de consulta en “SQL” siempre me pareció difícil y muchas veces me han recomendado aprender bien lo que hace. Hoy me tome la molestia de leer documentación y ver tutoriales sobre cómo funciona, a decir verdad, me dejo muy sorprendido sobre cómo funciona y lo que hace; en resumen, hace una consulta con los datos de dos tablas creando una tabla con los datos solicitados que solo existe en memoria, al refrescar el gestor de base de datos se elimina esa tabla.
This type of query in “SQL” always seemed difficult to me and many times I have been recommended to learn what it does. Today I took the trouble to read documentation and watch tutorials on how it works, to tell the truth, I was very surprised by how it works and what it does; In short, it makes a query with the data from two tables, creating a table with the requested data that only exists in memory. When you refresh the database manager, that table is deleted.


Para comprender bien cómo funciona empecé con un ejemplo sencillo de dos tablas en la cual una posee datos de empleados y otra de departamentos a los cuales pertenece cada empleado.
Cada tabla posee una columna con el mismo nombre por ende esta consulta es más sencilla y no tiene mucha complejidad, la relación está en que tanto la tabla empleados como la tabla departamentos poseen un identificador de departamento.
To fully understand how it works, I started with a simple example of two tables in which one has data on employees and another on the departments to which each employee belongs. Each table has a column with the same name, therefore this query is simpler and does not have much complexity, the relationship is that both the employees table and the departments table have a department identifier.


Este tipo de consulta tiene una gran ventaja cuando se necesitan relacionar los datos de aquellas tablas en las cuales puede no existir una relación directa, ya sea por cómo se administró la base datos u porque no era necesaria.
This type of query has a great advantage when it is necessary to relate the data of those tables in which there may not be a direct relationship, either because of how the database was administered or because it was not necessary.
Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!
Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).
You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support.