Skip to content

Instantly share code, notes, and snippets.

@david-mart
Last active June 11, 2019 20:43
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 david-mart/84d2d39cb9205a4aca737dea0a7ffa16 to your computer and use it in GitHub Desktop.
Save david-mart/84d2d39cb9205a4aca737dea0a7ffa16 to your computer and use it in GitHub Desktop.
mysql> show databases;
+ - - - - - - - - - - +
| Database |
+ - - - - - - - - - - +
| products |
| users_and_orders |
+ - - - - - - - - - - +
mysql> show tables in users_and_orders;
+----------------------------+
| Tables_in_users_and_orders |
+----------------------------+
| order |
| user |
+----------------------------+
mysql> show tables in products;
+--------------------+
| Tables_in_products |
+--------------------+
| product |
+--------------------+
mysql> select * from users_and_orders.user;
+----+-----------------+
| id | name |
+----+-----------------+
| 1 | Jamie Lannister |
| 2 | Jon Snow |
+----+-----------------+
mysql> select * from users_and_orders.order;
+----+---------+---------------------+
| id | user_id | order_date |
+----+---------+---------------------+
| 1 | 1 | 2019-05-10 07:00:00 |
| 2 | 1 | 2019-05-11 07:00:00 |
| 3 | 1 | 2019-05-12 07:00:00 |
| 4 | 1 | 2019-05-13 07:00:00 |
| 5 | 1 | 2019-06-01 07:00:00 |
| 6 | 1 | 2019-06-03 07:00:00 |
+----+---------+---------------------+
mysql> select * from products.product;
+----+----------+------------+
| id | order_id | name |
+----+----------+------------+
| 1 | 1 | oathkeeper |
| 2 | 1 | longclaw |
| 3 | 1 | needle |
+----+----------+------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment