This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MariaDB [fun]> SELECT COUNT(DISTINCT last_name) AS cardinality FROM users; | |
| +-------------+ | |
| | cardinality | | |
| +-------------+ | |
| | 9 | | |
| +-------------+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MariaDB [fun]> SELECT * FROM users; | |
| +----+------------+------------+ | |
| | id | first_name | last_name | | |
| +----+------------+------------+ | |
| | 1 | Batista | Harahap | | |
| | 2 | Rinto | Harahap | | |
| | 3 | Michael | Jordan | | |
| | 4 | Chris | Martin | | |
| | 5 | Jordan | Sparks | | |
| | 6 | Daniel | Craig | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MariaDB [fun]> EXPLAIN SELECT * FROM users WHERE last_name = 'Harahap'; | |
| +------+-------------+-------+------+---------------+------------+---------+-------+------+-----------------------+ | |
| | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
| +------+-------------+-------+------+---------------+------------+---------+-------+------+-----------------------+ | |
| | 1 | SIMPLE | users | ref | last_names | last_names | 53 | const | 2 | Using index condition | | |
| +------+-------------+-------+------+---------------+------------+---------+-------+------+-----------------------+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MariaDB [fun]> CREATE INDEX last_names ON users (last_name); | |
| Query OK, 0 rows affected (0.05 sec) | |
| Records: 0 Duplicates: 0 Warnings: 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MariaDB [fun]> EXPLAIN SELECT * FROM users WHERE last_name = 'Harahap'; | |
| +------+-------------+-------+------+---------------+------+---------+------+------+-------------+ | |
| | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
| +------+-------------+-------+------+---------------+------+---------+------+------+-------------+ | |
| | 1 | SIMPLE | users | ALL | NULL | NULL | NULL | NULL | 10 | Using where | | |
| +------+-------------+-------+------+---------------+------+---------+------+------+-------------+ | |
| 1 row in set (0.00 sec) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MariaDB [fun]> SELECT * FROM users WHERE last_name = 'Harahap'; | |
| +----+------------+-----------+ | |
| | id | first_name | last_name | | |
| +----+------------+-----------+ | |
| | 1 | Batista | Harahap | | |
| | 2 | Rinto | Harahap | | |
| +----+------------+-----------+ | |
| 2 rows in set (0.00 sec) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MariaDB [fun]> EXPLAIN SELECT * FROM users; | |
| +------+-------------+-------+------+---------------+------+---------+------+------+-------+ | |
| | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | | |
| +------+-------------+-------+------+---------------+------+---------+------+------+-------+ | |
| | 1 | SIMPLE | users | ALL | NULL | NULL | NULL | NULL | 10 | | | |
| +------+-------------+-------+------+---------------+------+---------+------+------+-------+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MariaDB [fun]> SELECT * FROM users; | |
| +----+------------+------------+ | |
| | id | first_name | last_name | | |
| +----+------------+------------+ | |
| | 1 | Batista | Harahap | | |
| | 2 | Rinto | Harahap | | |
| | 3 | Michael | Jordan | | |
| | 4 | Chris | Martin | | |
| | 5 | Jordan | Sparks | | |
| | 6 | Daniel | Craig | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| first_name, | |
| last_name | |
| FROM | |
| names |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT * FROM users |