TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

MySQL

MySQL Comma Joins

Overview

In this tutorial, we will learn MySQL Comma Joins. This syntax is one way to perform inner join. To combine data from two or more tables to find the detail of rows referenced by a foreign key, we can perform the join. One such way to do the join operation is to specify the list of tables with comma separator in the FORM clause of the SELECT statement. We can specify the relationship between the two tables using the WHERE clause.

Comma Join Syntax

In this syntax, we will specify a list of comma separated tables (that participate in the join) in the FROM clause of the SELECT statement. The WHERE clause is used to indicate the relationship between the tables.

The general comma join syntax of two tables is as follows:

SELECT <column_list>
FROM <table1>, <table2>
WHERE <table_relationship_conditions> ;

Example

Let’s consider Country and CountryLanguage tables in the world MySQL database in this example. Suppose that we want to find all the languages spoken in North America countries. This information cannot be found in just one table of the database.

We need to join the Country and the CountryLanguage tables in the world database. We have to extract the country names from the Country table and the languages from the CountryLanguage table.

 

mysql> SELECT Code, Name, Language
         -> FROM Country, CountryLanguage
         -> WHERE Code = CountryCode
         -> AND Continent=’North America’;

 

Notice the use of comma separator in the FROM clause used to join the tables.

—

MySQL Tutorials

MySQL Tutorials on this website:

https://www.testingdocs.com/mysql-tutorials-for-beginners/

For more information on MySQL Database:

https://www.mysql.com/

Related Posts

MySQL /

Launch DataGrip on Windows

MySQL /

Install DataGrip IDE on Windows 11

MySQL /

New MySQL Connection in Workbench

MySQL /

Command-Line MySQL Client

MySQL /

Start MySQL Client on Windows 11

‹ MySQLImport Options› LAMP Stack Components

Recent Posts

  • Scaler Academy – An Online Learning Platform
  • Difference between PHP and JavaScript?
  • MS Access Data Types
  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • Build & Run CLion Project
  • Create New CLion C Project on Windows
  • Configure CLion Toolchains on Windows
  • Launch CLion IDE on Windows

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com