Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 124 Server version: 11.8.6-MariaDB-0+deb13u1 from Debian -- Please help get to 10k stars at https://github.com/MariaDB/Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> use sks; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [sks]> show tables; +------------------+ | Tables_in_sks | +------------------+ | advisor | | classroom | | course | | department | | instructor | | instructor_title | | prereq | | section | | student | | takes | | teaches | | time_slot | +------------------+ 12 rows in set (0.001 sec) MariaDB [sks]> describe section; +--------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+--------------+------+-----+---------+-------+ | course_id | varchar(8) | NO | PRI | NULL | | | sec_id | varchar(8) | NO | PRI | NULL | | | semester | varchar(6) | NO | PRI | NULL | | | year | decimal(4,0) | NO | PRI | NULL | | | building | varchar(15) | YES | MUL | NULL | | | room_number | varchar(7) | YES | | NULL | | | time_slot_id | varchar(4) | YES | | NULL | | +--------------+--------------+------+-----+---------+-------+ 7 rows in set (0.005 sec) MariaDB [sks]> select id,name from instructor -> ; +-------+------------+ | id | name | +-------+------------+ | 10101 | Srinivasan | | 12121 | Wu | | 15151 | Mozart | | 22222 | Einstein | | 32343 | El Said | | 33456 | Gold | | 45565 | Katz | | 58583 | Califieri | | 76543 | Singh | | 76766 | Crick | | 83821 | Brandt | | 98345 | Kim | +-------+------------+ 12 rows in set (0.006 sec) MariaDB [sks]> select name,id from instructor; +------------+-------+ | name | id | +------------+-------+ | Srinivasan | 10101 | | Wu | 12121 | | Mozart | 15151 | | Einstein | 22222 | | El Said | 32343 | | Gold | 33456 | | Katz | 45565 | | Califieri | 58583 | | Singh | 76543 | | Crick | 76766 | | Brandt | 83821 | | Kim | 98345 | +------------+-------+ 12 rows in set (0.003 sec) MariaDB [sks]> select * from instructor; +-------+------------+------------+----------+ | ID | name | dept_name | salary | +-------+------------+------------+----------+ | 10101 | Srinivasan | Comp. Sci. | 65000.00 | | 12121 | Wu | Finance | 90000.00 | | 15151 | Mozart | Music | 40000.00 | | 22222 | Einstein | Physics | 95000.00 | | 32343 | El Said | History | 60000.00 | | 33456 | Gold | Physics | 87000.00 | | 45565 | Katz | Comp. Sci. | 75000.00 | | 58583 | Califieri | History | 62000.00 | | 76543 | Singh | Finance | 80000.00 | | 76766 | Crick | Biology | 72000.00 | | 83821 | Brandt | Comp. Sci. | 92000.00 | | 98345 | Kim | Elec. Eng. | 80000.00 | +-------+------------+------------+----------+ 12 rows in set (0.003 sec) MariaDB [sks]> select name from instructor where dept_name = 'Physics' and salary > 90000; +----------+ | name | +----------+ | Einstein | +----------+ 1 row in set (0.004 sec) MariaDB [sks]> describe instructor; +-----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+--------------+------+-----+---------+-------+ | ID | varchar(5) | NO | PRI | NULL | | | name | varchar(20) | NO | | NULL | | | dept_name | varchar(20) | YES | MUL | NULL | | | salary | decimal(8,2) | YES | | NULL | | +-----------+--------------+------+-----+---------+-------+ 4 rows in set (0.004 sec) MariaDB [sks]> select dept_name from instructor; +------------+ | dept_name | +------------+ | Biology | | Comp. Sci. | | Comp. Sci. | | Comp. Sci. | | Elec. Eng. | | Finance | | Finance | | History | | History | | Music | | Physics | | Physics | +------------+ 12 rows in set (0.003 sec) MariaDB [sks]> select salary from instructor; +----------+ | salary | +----------+ | 65000.00 | | 90000.00 | | 40000.00 | | 95000.00 | | 60000.00 | | 87000.00 | | 75000.00 | | 62000.00 | | 80000.00 | | 72000.00 | | 92000.00 | | 80000.00 | +----------+ 12 rows in set (0.003 sec) MariaDB [sks]> select distinct dept_name from instructor; +------------+ | dept_name | +------------+ | Biology | | Comp. Sci. | | Elec. Eng. | | Finance | | History | | Music | | Physics | +------------+ 7 rows in set (0.005 sec) MariaDB [sks]> select distinct salary from instructor; +----------+ | salary | +----------+ | 65000.00 | | 90000.00 | | 40000.00 | | 95000.00 | | 60000.00 | | 87000.00 | | 75000.00 | | 62000.00 | | 80000.00 | | 72000.00 | | 92000.00 | +----------+ 11 rows in set (0.003 sec) MariaDB [sks]> select * from instructor,teaches where instructor.ID = teaches.ID; +-------+------------+------------+----------+-------+-----------+--------+----------+------+ | ID | name | dept_name | salary | ID | course_id | sec_id | semester | year | +-------+------------+------------+----------+-------+-----------+--------+----------+------+ | 76766 | Crick | Biology | 72000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 76766 | Crick | Biology | 72000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 12121 | Wu | Finance | 90000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | +-------+------------+------------+----------+-------+-----------+--------+----------+------+ 15 rows in set (0.002 sec) MariaDB [sks]> explain select * from instructor,teaches where instructor.ID = teaches.ID; +------+-------------+------------+--------+---------------+-----------+---------+----------------+------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +------+-------------+------------+--------+---------------+-----------+---------+----------------+------+-------------+ | 1 | SIMPLE | teaches | index | PRIMARY | course_id | 96 | NULL | 15 | Using index | | 1 | SIMPLE | instructor | eq_ref | PRIMARY | PRIMARY | 22 | sks.teaches.ID | 1 | | +------+-------------+------------+--------+---------------+-----------+---------+----------------+------+-------------+ 2 rows in set (0.004 sec)