..


Sponsored Links

How do I create a query on two tables?

To create a relationship between two tables in SQL we can use the traditional method, or the JOIN statement.

Imagine the following tables, composed of the respective fields:

  • authors
    • aut_id
    • aut_nome
  • books
    • lib_id
    • lib_autore
    • lib_titolo
The field lib_autore, numerical, will have the same value as the id of the author of the homonymous table.

We see the classic method to write the SQL code:





 SELECT * FROM authors, books







 WHERE







 aut_id = lib_autore



We see the method that provides education JOIN:





 SELECT * FROM authors







 INNER JOIN books







 ON = aut_id lib_autore



In the same category ...
E-Learning
MS Access (Advanced) MS Access (Advanced)
Learn how to create and manage databases quickly and easily. Starting from 29 €.
MySQL (Course) MySQL (Course)
Management of open-source database. From 39 €.
SQL and Database (Course) SQL and Database (Course)
Create and manage relational databases. From 39 €.
Sponsored Links