MariaDB INNER JOIN is the most common type of join which returns all rows from multiple tables where the join condition is satisfied.
Syntax:
SELECT columns
FROM table1
INNER JOIN table2
ON table1.column = table2.column;
Example:
We have two tables' sites and pages:
Sites table:
site_id site_name
100 javatpoint.com
200 Facebook.com
300 Yahoo.com
400 Google.com
Pages table:
page_id site_id page_title
1 100 MariaDB
2 100 MySQL
3 200 Java interview questions
4 300 Software testing
5 500 Flight booking
Now execute the following commands:
SELECT sites.site_id, sites.site_name, pages.page_id, pages.page_title FROM sites INNER JOIN pages ON sites.site_id= page.site_id
Output:
site_id site_name page_id page_title
100 javatpoint 1 MariaDB
100 javatpoint 2 MySQL
200 Facebook.com 3 Java interview questions
300 Yahoo.com 4 Software testing