Get the App
SLTechnology News&Howtos  ›  Database  › 

How to use inner join in sql

Shulou Source: shulou.com Published: 2022-05-31 23:54:52 10月03日 Update

This article is about how to use inner join in sql. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The usage of inner join in sql

Inner join is a multi-table join keyword.

Syntax:

SELECT * FROM table1 INNER JOIN table2 ON table1.field1 compopr table2.field2

INNER JOIN operation can be divided into the following parts:

Part

Description

Table1, table2

Record the name of the combined table.

Field1, field2

The name of the joined field. If they are not made up of numbers, these fields must be the same

Data types and contain similar data, but they do not need to have the same name.

Compopr

Any relational comparison operator: "=,", "=," or "."

For example: to look up the fields of Categories.CategoryID = Products.CategoryID in 2 tables

SELECT CategoryName, ProductNameFROM Categories INNER JOIN ProductsON Categories.CategoryID = Products.CategoryID

2 tables are associated with the meaning of querying related data

Thank you for reading! This is the end of the article on "how to use inner join in sql". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Name field data same content more article good practical individual key keyword similar meaning number article by look knowledge operator Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Information MySQL Huawei Shulou Technology