# EQ()

## Overview

Returns a boolean indicating if two values are equivalent.

## USAGE

```EQ(value1, value2)
```

Argument Name

Description

`value`

The two values to compare

## DETAILS

`EQ()` is a function that compares two values, returning `1` (true) if both values are equivalent, otherwise `0` (false).

If at least one value is a number, a numeric comparison is performed. Thus, a string value is converted into a number when paired with a numeric value.

When both values are strings, the comparison takes into account the current sort order, which might treat uppercase and lowercase letters as equivalent. For a function that does not ignore case, see IDENTICAL().

A `NULL` is returned if either argument is `NULL`.

The function call `EQ(x, y)` behaves in exactly the same manner as the operator expression `x = y`.

## EXAMPLES

```SELECT EQ(42, 42), EQ(1, 0), EQ(NULL, NULL);
```
```+------------+----------+----------------+
| EQ(42, 42) | EQ(1, 0) | EQ(NULL, NULL) |
+------------+----------+----------------+
|          1 |        0 |           NULL |
+------------+----------+----------------+
```
```SELECT EQ(99, 123),
EQ(PI(), 3.141592653589793) AS pi_eq;
```
```+-------------+-------+
| EQ(99, 123) | pi_eq |
+-------------+-------+
|           0 |     1 |
+-------------+-------+
```
```-- Disable strict mode or the select might throw an error
SET sql_mode = '';
SELECT EQ(99, '99a'), EQ('abc', 0);
```
```+---------------+--------------+
| EQ(99, '99a') | EQ('abc', 0) |
+---------------+--------------+
|             1 |            1 |
+---------------+--------------+
```
```CREATE TABLE eq_example (
description VARCHAR(20),
example INT
);
```
```INSERT INTO eq_example VALUES
('Everything', 42),
('Dalmations', 101),
('Agent', 99),
('B. Doz.', 13),
('CPU', 64);
```
```SELECT *
FROM eq_example
WHERE EQ(example, 101) OR EQ(description, 'B. Doz.');
```
```+-------------+---------+
| description | example |
+-------------+---------+
| Dalmations  |     101 |
| B. Doz.     |      13 |
+-------------+---------+
```

## CHANGE HISTORY

Release Series

History

23.09

• Present starting in MariaDB Xpand 23.09.1.

6.1

• Present starting in MariaDB Xpand 6.1.0.

6.0

• Present starting in MariaDB Xpand 6.0.3.

5.3

• Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

• Present starting in MariaDB Xpand 6.0.3.

5.3

• Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

• Present starting in MariaDB Xpand 6.1.0.