(NULL, ’t-shirt’, ’white’, @last); SELECT * FROM person; +----+---------------------+ | id | name | +----+---------------------+ | 1 | Antonio Paz | | 2 | Lilliana Angelovska | +----+---------------------+ SELECT * FROM shirt; +----+---------+--------+-------+ | id | style | color | owner | +----+---------+--------+-------+ | 1 | polo | blue | 1 | | 2 | dress | white | 1 | | 3 | t-shirt | blue | 1 | | 4 | dress | orange | 2 | | 5 | polo | red | 2 | | 6 | dress | blue | 2 | | 7 | t-shirt | white | 2 | +----+---------+--------+-------+ SELECT s.* FROM person p INNER JOIN shirt s ON s.owner = p.id  WHERE p.name LIKE ’Lilliana%’ AND s.color <> ’white’; +----+-------+--------+-------+ | id | style | color | owner | +----+-------+--------+-------+ | 4 | dress | orange | 2 | | 5 | polo | red | 2 | | 6 | dress | blue | 2 | +----+-------+--------+-------+ 

When used in this fashion, the REFERENCES  clause is not displayed in the output of SHOW CREATE TABLE or DESCRIBE : 

SHOW CREATE TABLE shirt\G *************************** 1. row *************************** Table: shirt Create Table: CREATE TABLE ‘shirt‘ ( ‘id‘ smallint(5) unsigned NOT NULL auto_increment, ‘style‘ enum(’t-shirt’,’polo’,’dress’) NOT NULL, ‘color‘ enum(’red’,’blue’,’orange’,’white’,’black’) NOT NULL, ‘owner‘ smallint(5) unsigned NOT NULL, PRIMARY KEY (‘id‘) ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 

The use of REFERENCES  in this way as a comment or “reminder”  in a column definition works with MyISAM tables. 

## 3.6.7 Searching on Two Keys 

An OR  using a single key is well optimized, as is the handling of AND . 

The one tricky case is that of searching on two different keys combined with OR : 

SELECT field1_index, field2_index FROM test_table WHERE field1_index = ’1’ OR field2_index = ’1’ 

This case is optimized. See Section 8.2.1.3, “Index Merge Optimization” . 

