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 ANY Operator

Overview

In this tutorial, we will learn about MySQL ANY operator with example. The quantifier keywords ALL, ANY, and SOME allow comparison with multiple rows.

We can use the ANY comparison operator in a comparison with a column subquery results to get any rows where the comparison is true by the subquery. Comparisons using the keyword ANY will succeed for any values in the column of data found by the subquery which succeed in the comparison.

Example

In this example, we will use the Country and the CountryLanguage tables from the world MySQL database.

ANY Operator

We will use the ANY operator to findĀ  the countries from the Europe continent, and, for each country tests whether the country is among the worldwide list of countries where ‘German’ is spoken.

mysql> SELECT Name
-> FROM Country
-> WHERE Continent = ‘Europe’
-> AND Code = ANY (SELECT CountryCode
-> FROM CountryLanguage
-> WHERE Language = ‘German’);

+—————-+
| Name |
+—————-+
| Austria |
| Belgium |
| Switzerland |
| Czech Republic |
| Germany |
| Denmark |
| Hungary |
| Italy |
| Liechtenstein |
| Luxembourg |
| Poland |
| Romania |
+—————-+
12 rows in set (0.00 sec)

MySQL ANY Operator

The IN operator when used with a subquery is equivalent to = ANY operator.

—

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 Workbench Windows 11

MySQL /

New MySQL Connection in Workbench

MySQL Command-line Client

MySQL /

Command-Line MySQL Client

Start MySQL Client

MySQL /

Start MySQL Client on Windows 11

Windows 11 Services Run Prompt

MySQL /

Start MySQL Server on Windows 11

MySQL Community Downloads TDocs

MySQL /

Download & Install MySQL on Windows 11

‹ MySQL ALL Operator› MySQL Inline Views

Recent Posts

  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • RAPTOR Editions
  • Flowgorithm Conditional Breakpoint Statement
  • Flowgorithm Read Numbers from File Example
  • Search Text File Flowchart Example
  • Flowgorithm Turtle Graphics Symbols
  • Draw Circle using Flowgorithm Turtle
  • Draw Parallel Lines using Flowgorithm Graphics

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version