Skip to content

Instantly share code, notes, and snippets.

@penso
Last active December 23, 2015 10:29
Show Gist options
  • Save penso/6621519 to your computer and use it in GitHub Desktop.
Save penso/6621519 to your computer and use it in GitHub Desktop.
Friends table
mysql> desc relationships;
+-----------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------------+------+-----+---------+-------+
| user_id | int(11) | NO | PRI | 0 | |
| friend_id | int(11) | NO | PRI | 0 | |
| status | tinyint(4) | NO | | 0 | |
+-----------+------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql> show indexes from relationships;
+---------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+---------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| relationships | 0 | PRIMARY | 1 | user_id | A | 0 | NULL | NULL | | BTREE | |
| relationships | 0 | PRIMARY | 2 | friend_id | A | 0 | NULL | NULL | | BTREE | |
+---------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
2 rows in set (0.00 sec)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment