Skip to content

Instantly share code, notes, and snippets.

@morgo
Created January 29, 2015 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morgo/779e0c9d8701a5141553 to your computer and use it in GitHub Desktop.
Save morgo/779e0c9d8701a5141553 to your computer and use it in GitHub Desktop.
5.7 OR example
mysql [localhost] {msandbox} (test) > SELECT version();
+---------------+
| version() |
+---------------+
| 5.7.5-m15-log |
+---------------+
1 row in set (0.00 sec)
mysql [localhost] {msandbox} (test) > SHOW VARIABLES LIKE 'sql_mode';
+---------------+---------------------------------------------------------------+
| Variable_name | Value |
+---------------+---------------------------------------------------------------+
| sql_mode | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION |
+---------------+---------------------------------------------------------------+
1 row in set (0.00 sec)
mysql [localhost] {msandbox} (test) > CREATE TABLE book (id INT NOT NULL PRIMARY KEY auto_increment);
Query OK, 0 rows affected (0.03 sec)
mysql [localhost] {msandbox} (test) > INSERT INTO book VALUES (NULL),(NULL),(NULL),(NULL);
Query OK, 4 rows affected (0.02 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql [localhost] {msandbox} (test) > SELECT * FROM book WHERE id = 1 OR 2;
+----+
| id |
+----+
| 1 |
| 2 |
| 3 |
| 4 |
+----+
4 rows in set (0.01 sec)
mysql [localhost] {msandbox} (test) > DELETE FROM book WHERE id = 1 OR 2;
Query OK, 4 rows affected (0.01 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment