Skip to content

Instantly share code, notes, and snippets.

@hobodave
Created July 26, 2009 01:49
Show Gist options
  • Select an option

  • Save hobodave/155400 to your computer and use it in GitHub Desktop.

Select an option

Save hobodave/155400 to your computer and use it in GitHub Desktop.
use test
Database changed
mysql> CREATE TABLE `a` (
-> `id` int(11) DEFAULT NULL
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8
-> ;
Query OK, 0 rows affected (0.01 sec)
mysql> INSERT INTO a (id) VALUES (1),(2),(3);
Query OK, 3 rows affected (0.01 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> CREATE TABLE `aa` (
-> `id` int(11) DEFAULT NULL
-> ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.02 sec)
mysql> INSERT INTO aa (id) VALUES (1),(2),(3);
Query OK, 3 rows affected (0.01 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> CREATE VIEW magic AS SELECT a.id AS a_id, aa.id AS aa_id FROM a JOIN aa ON a.id = aa.id;
Query OK, 0 rows affected (0.02 sec)
mysql> CREATE TABLE magic ENGINE=MEMORY
-> SELECT a.id AS a_id, aa.id AS aa_id FROM a JOIN aa ON a.id = aa.id;
ERROR 2013 (HY000): Lost connection to MySQL server during query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment