Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 136 Server version: 10.11.6-MariaDB-0+deb12u1 Debian 12 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 sksunivdemo 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 [sksunivdemo]> 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.081 sec) MariaDB [sksunivdemo]> select distinct dept_name -> from instructor; +------------+ | dept_name | +------------+ | Biology | | Comp. Sci. | | Elec. Eng. | | Finance | | History | | Music | | Physics | +------------+ 7 rows in set (0.082 sec) MariaDB [sksunivdemo]> select * from instructor where dept_name = 'Physics'; +-------+----------+-----------+----------+ | ID | name | dept_name | salary | +-------+----------+-----------+----------+ | 22222 | Einstein | Physics | 95000.00 | | 33456 | Gold | Physics | 87000.00 | +-------+----------+-----------+----------+ 2 rows in set (0.003 sec) MariaDB [sksunivdemo]> select ID,name,salary/12 from instructor; +-------+------------+-------------+ | ID | name | salary/12 | +-------+------------+-------------+ | 10101 | Srinivasan | 5416.666667 | | 12121 | Wu | 7500.000000 | | 15151 | Mozart | 3333.333333 | | 22222 | Einstein | 7916.666667 | | 32343 | El Said | 5000.000000 | | 33456 | Gold | 7250.000000 | | 45565 | Katz | 6250.000000 | | 58583 | Califieri | 5166.666667 | | 76543 | Singh | 6666.666667 | | 76766 | Crick | 6000.000000 | | 83821 | Brandt | 7666.666667 | | 98345 | Kim | 6666.666667 | +-------+------------+-------------+ 12 rows in set (0.001 sec) MariaDB [sksunivdemo]> select ID,name as instructor_name,salary/12 as monthly_salary from instructor; +-------+-----------------+----------------+ | ID | instructor_name | monthly_salary | +-------+-----------------+----------------+ | 10101 | Srinivasan | 5416.666667 | | 12121 | Wu | 7500.000000 | | 15151 | Mozart | 3333.333333 | | 22222 | Einstein | 7916.666667 | | 32343 | El Said | 5000.000000 | | 33456 | Gold | 7250.000000 | | 45565 | Katz | 6250.000000 | | 58583 | Califieri | 5166.666667 | | 76543 | Singh | 6666.666667 | | 76766 | Crick | 6000.000000 | | 83821 | Brandt | 7666.666667 | | 98345 | Kim | 6666.666667 | +-------+-----------------+----------------+ 12 rows in set (0.079 sec) MariaDB [sksunivdemo]> select name, course_id from instructor, teaches; +------------+-----------+ | name | course_id | +------------+-----------+ | Srinivasan | CS-101 | | Srinivasan | CS-315 | | Srinivasan | CS-347 | | Srinivasan | FIN-201 | | Srinivasan | MU-199 | | Srinivasan | PHY-101 | | Srinivasan | HIS-351 | | Srinivasan | CS-101 | | Srinivasan | CS-319 | | Srinivasan | BIO-101 | | Srinivasan | BIO-301 | | Srinivasan | CS-190 | | Srinivasan | CS-190 | | Srinivasan | CS-319 | | Srinivasan | EE-181 | | Wu | CS-101 | | Wu | CS-315 | | Wu | CS-347 | | Wu | FIN-201 | | Wu | MU-199 | | Wu | PHY-101 | | Wu | HIS-351 | | Wu | CS-101 | | Wu | CS-319 | | Wu | BIO-101 | | Wu | BIO-301 | | Wu | CS-190 | | Wu | CS-190 | | Wu | CS-319 | | Wu | EE-181 | | Mozart | CS-101 | | Mozart | CS-315 | | Mozart | CS-347 | | Mozart | FIN-201 | | Mozart | MU-199 | | Mozart | PHY-101 | | Mozart | HIS-351 | | Mozart | CS-101 | | Mozart | CS-319 | | Mozart | BIO-101 | | Mozart | BIO-301 | | Mozart | CS-190 | | Mozart | CS-190 | | Mozart | CS-319 | | Mozart | EE-181 | | Einstein | CS-101 | | Einstein | CS-315 | | Einstein | CS-347 | | Einstein | FIN-201 | | Einstein | MU-199 | | Einstein | PHY-101 | | Einstein | HIS-351 | | Einstein | CS-101 | | Einstein | CS-319 | | Einstein | BIO-101 | | Einstein | BIO-301 | | Einstein | CS-190 | | Einstein | CS-190 | | Einstein | CS-319 | | Einstein | EE-181 | | El Said | CS-101 | | El Said | CS-315 | | El Said | CS-347 | | El Said | FIN-201 | | El Said | MU-199 | | El Said | PHY-101 | | El Said | HIS-351 | | El Said | CS-101 | | El Said | CS-319 | | El Said | BIO-101 | | El Said | BIO-301 | | El Said | CS-190 | | El Said | CS-190 | | El Said | CS-319 | | El Said | EE-181 | | Gold | CS-101 | | Gold | CS-315 | | Gold | CS-347 | | Gold | FIN-201 | | Gold | MU-199 | | Gold | PHY-101 | | Gold | HIS-351 | | Gold | CS-101 | | Gold | CS-319 | | Gold | BIO-101 | | Gold | BIO-301 | | Gold | CS-190 | | Gold | CS-190 | | Gold | CS-319 | | Gold | EE-181 | | Katz | CS-101 | | Katz | CS-315 | | Katz | CS-347 | | Katz | FIN-201 | | Katz | MU-199 | | Katz | PHY-101 | | Katz | HIS-351 | | Katz | CS-101 | | Katz | CS-319 | | Katz | BIO-101 | | Katz | BIO-301 | | Katz | CS-190 | | Katz | CS-190 | | Katz | CS-319 | | Katz | EE-181 | | Califieri | CS-101 | | Califieri | CS-315 | | Califieri | CS-347 | | Califieri | FIN-201 | | Califieri | MU-199 | | Califieri | PHY-101 | | Califieri | HIS-351 | | Califieri | CS-101 | | Califieri | CS-319 | | Califieri | BIO-101 | | Califieri | BIO-301 | | Califieri | CS-190 | | Califieri | CS-190 | | Califieri | CS-319 | | Califieri | EE-181 | | Singh | CS-101 | | Singh | CS-315 | | Singh | CS-347 | | Singh | FIN-201 | | Singh | MU-199 | | Singh | PHY-101 | | Singh | HIS-351 | | Singh | CS-101 | | Singh | CS-319 | | Singh | BIO-101 | | Singh | BIO-301 | | Singh | CS-190 | | Singh | CS-190 | | Singh | CS-319 | | Singh | EE-181 | | Crick | CS-101 | | Crick | CS-315 | | Crick | CS-347 | | Crick | FIN-201 | | Crick | MU-199 | | Crick | PHY-101 | | Crick | HIS-351 | | Crick | CS-101 | | Crick | CS-319 | | Crick | BIO-101 | | Crick | BIO-301 | | Crick | CS-190 | | Crick | CS-190 | | Crick | CS-319 | | Crick | EE-181 | | Brandt | CS-101 | | Brandt | CS-315 | | Brandt | CS-347 | | Brandt | FIN-201 | | Brandt | MU-199 | | Brandt | PHY-101 | | Brandt | HIS-351 | | Brandt | CS-101 | | Brandt | CS-319 | | Brandt | BIO-101 | | Brandt | BIO-301 | | Brandt | CS-190 | | Brandt | CS-190 | | Brandt | CS-319 | | Brandt | EE-181 | | Kim | CS-101 | | Kim | CS-315 | | Kim | CS-347 | | Kim | FIN-201 | | Kim | MU-199 | | Kim | PHY-101 | | Kim | HIS-351 | | Kim | CS-101 | | Kim | CS-319 | | Kim | BIO-101 | | Kim | BIO-301 | | Kim | CS-190 | | Kim | CS-190 | | Kim | CS-319 | | Kim | EE-181 | +------------+-----------+ 180 rows in set (0.080 sec) MariaDB [sksunivdemo]> select * from instructor, teaches; +-------+------------+------------+----------+-------+-----------+--------+----------+------+ | ID | name | dept_name | salary | ID | course_id | sec_id | semester | year | +-------+------------+------------+----------+-------+-----------+--------+----------+------+ | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 12121 | Wu | Finance | 90000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 12121 | Wu | Finance | 90000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 12121 | Wu | Finance | 90000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 12121 | Wu | Finance | 90000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 12121 | Wu | Finance | 90000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 12121 | Wu | Finance | 90000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 12121 | Wu | Finance | 90000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 12121 | Wu | Finance | 90000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 15151 | Mozart | Music | 40000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 15151 | Mozart | Music | 40000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 15151 | Mozart | Music | 40000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 15151 | Mozart | Music | 40000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 15151 | Mozart | Music | 40000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 15151 | Mozart | Music | 40000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 15151 | Mozart | Music | 40000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 15151 | Mozart | Music | 40000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 22222 | Einstein | Physics | 95000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 22222 | Einstein | Physics | 95000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 22222 | Einstein | Physics | 95000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 22222 | Einstein | Physics | 95000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 22222 | Einstein | Physics | 95000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 22222 | Einstein | Physics | 95000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 22222 | Einstein | Physics | 95000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 22222 | Einstein | Physics | 95000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 32343 | El Said | History | 60000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 32343 | El Said | History | 60000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 32343 | El Said | History | 60000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 32343 | El Said | History | 60000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 32343 | El Said | History | 60000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 32343 | El Said | History | 60000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 32343 | El Said | History | 60000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 32343 | El Said | History | 60000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 33456 | Gold | Physics | 87000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 33456 | Gold | Physics | 87000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 33456 | Gold | Physics | 87000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 33456 | Gold | Physics | 87000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 33456 | Gold | Physics | 87000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 33456 | Gold | Physics | 87000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 33456 | Gold | Physics | 87000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 33456 | Gold | Physics | 87000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 58583 | Califieri | History | 62000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 58583 | Califieri | History | 62000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 58583 | Califieri | History | 62000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 58583 | Califieri | History | 62000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 58583 | Califieri | History | 62000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 58583 | Califieri | History | 62000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 58583 | Califieri | History | 62000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 58583 | Califieri | History | 62000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 76543 | Singh | Finance | 80000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 76543 | Singh | Finance | 80000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 76543 | Singh | Finance | 80000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 76543 | Singh | Finance | 80000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 76543 | Singh | Finance | 80000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 76543 | Singh | Finance | 80000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 76543 | Singh | Finance | 80000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 76543 | Singh | Finance | 80000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 76766 | Crick | Biology | 72000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 76766 | Crick | Biology | 72000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 76766 | Crick | Biology | 72000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 76766 | Crick | Biology | 72000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 76766 | Crick | Biology | 72000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 76766 | Crick | Biology | 72000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 76766 | Crick | Biology | 72000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 76766 | Crick | Biology | 72000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 76766 | BIO-301 | 1 | Summer | 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 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 98345 | EE-181 | 1 | Spring | 2017 | +-------+------------+------------+----------+-------+-----------+--------+----------+------+ 180 rows in set (0.001 sec) MariaDB [sksunivdemo]> select distinct * from instructor, teaches; +-------+------------+------------+----------+-------+-----------+--------+----------+------+ | ID | name | dept_name | salary | ID | course_id | sec_id | semester | year | +-------+------------+------------+----------+-------+-----------+--------+----------+------+ | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 12121 | Wu | Finance | 90000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 12121 | Wu | Finance | 90000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 12121 | Wu | Finance | 90000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 12121 | Wu | Finance | 90000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 12121 | Wu | Finance | 90000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 12121 | Wu | Finance | 90000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 12121 | Wu | Finance | 90000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 12121 | Wu | Finance | 90000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 12121 | Wu | Finance | 90000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 15151 | Mozart | Music | 40000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 15151 | Mozart | Music | 40000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 15151 | Mozart | Music | 40000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 15151 | Mozart | Music | 40000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 15151 | Mozart | Music | 40000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 15151 | Mozart | Music | 40000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 15151 | Mozart | Music | 40000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 15151 | Mozart | Music | 40000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 15151 | Mozart | Music | 40000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 22222 | Einstein | Physics | 95000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 22222 | Einstein | Physics | 95000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 22222 | Einstein | Physics | 95000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 22222 | Einstein | Physics | 95000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 22222 | Einstein | Physics | 95000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 22222 | Einstein | Physics | 95000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 22222 | Einstein | Physics | 95000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 22222 | Einstein | Physics | 95000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 22222 | Einstein | Physics | 95000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 32343 | El Said | History | 60000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 32343 | El Said | History | 60000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 32343 | El Said | History | 60000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 32343 | El Said | History | 60000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 32343 | El Said | History | 60000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 32343 | El Said | History | 60000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 32343 | El Said | History | 60000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 32343 | El Said | History | 60000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 32343 | El Said | History | 60000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 33456 | Gold | Physics | 87000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 33456 | Gold | Physics | 87000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 33456 | Gold | Physics | 87000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 33456 | Gold | Physics | 87000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 33456 | Gold | Physics | 87000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 33456 | Gold | Physics | 87000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 33456 | Gold | Physics | 87000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 33456 | Gold | Physics | 87000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 33456 | Gold | Physics | 87000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 45565 | Katz | Comp. Sci. | 75000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 58583 | Califieri | History | 62000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 58583 | Califieri | History | 62000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 58583 | Califieri | History | 62000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 58583 | Califieri | History | 62000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 58583 | Califieri | History | 62000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 58583 | Califieri | History | 62000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 58583 | Califieri | History | 62000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 58583 | Califieri | History | 62000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 58583 | Califieri | History | 62000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 76543 | Singh | Finance | 80000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 76543 | Singh | Finance | 80000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 76543 | Singh | Finance | 80000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 76543 | Singh | Finance | 80000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 76543 | Singh | Finance | 80000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 76543 | Singh | Finance | 80000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 76543 | Singh | Finance | 80000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 76543 | Singh | Finance | 80000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 76543 | Singh | Finance | 80000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 76766 | Crick | Biology | 72000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 76766 | Crick | Biology | 72000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 76766 | Crick | Biology | 72000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 76766 | Crick | Biology | 72000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 76766 | Crick | Biology | 72000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 76766 | Crick | Biology | 72000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 76766 | Crick | Biology | 72000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 76766 | Crick | Biology | 72000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 76766 | BIO-301 | 1 | Summer | 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 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 98345 | EE-181 | 1 | Spring | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 15151 | MU-199 | 1 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 83821 | CS-190 | 1 | Spring | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 83821 | CS-190 | 2 | Spring | 2017 | | 98345 | Kim | Elec. Eng. | 80000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 98345 | EE-181 | 1 | Spring | 2017 | +-------+------------+------------+----------+-------+-----------+--------+----------+------+ 180 rows in set (0.081 sec) MariaDB [sksunivdemo]> select name, course_id from instructor, teaches where instructor.ID = teaches.ID; +------------+-----------+ | name | course_id | +------------+-----------+ | Srinivasan | CS-101 | | Srinivasan | CS-315 | | Srinivasan | CS-347 | | Wu | FIN-201 | | Mozart | MU-199 | | Einstein | PHY-101 | | El Said | HIS-351 | | Katz | CS-101 | | Katz | CS-319 | | Crick | BIO-101 | | Crick | BIO-301 | | Brandt | CS-190 | | Brandt | CS-190 | | Brandt | CS-319 | | Kim | EE-181 | +------------+-----------+ 15 rows in set (0.081 sec) MariaDB [sksunivdemo]> select * from instructor, teaches where instructor.ID = teaches.ID; +-------+------------+------------+----------+-------+-----------+--------+----------+------+ | ID | name | dept_name | salary | ID | course_id | sec_id | semester | year | +-------+------------+------------+----------+-------+-----------+--------+----------+------+ | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-101 | 1 | Fall | 2017 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-315 | 1 | Spring | 2018 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-347 | 1 | Fall | 2017 | | 12121 | Wu | Finance | 90000.00 | 12121 | FIN-201 | 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 | | 32343 | El Said | History | 60000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 45565 | CS-101 | 1 | Spring | 2018 | | 45565 | Katz | Comp. Sci. | 75000.00 | 45565 | CS-319 | 1 | Spring | 2018 | | 76766 | Crick | Biology | 72000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | | 76766 | Crick | Biology | 72000.00 | 76766 | BIO-301 | 1 | Summer | 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 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 83821 | CS-319 | 2 | Spring | 2018 | | 98345 | Kim | Elec. Eng. | 80000.00 | 98345 | EE-181 | 1 | Spring | 2017 | +-------+------------+------------+----------+-------+-----------+--------+----------+------+ 15 rows in set (0.078 sec) MariaDB [sksunivdemo]> select name, course_id from instructor, teaches where instructor.ID = teaches.ID; +------------+-----------+ | name | course_id | +------------+-----------+ | Srinivasan | CS-101 | | Srinivasan | CS-315 | | Srinivasan | CS-347 | | Wu | FIN-201 | | Mozart | MU-199 | | Einstein | PHY-101 | | El Said | HIS-351 | | Katz | CS-101 | | Katz | CS-319 | | Crick | BIO-101 | | Crick | BIO-301 | | Brandt | CS-190 | | Brandt | CS-190 | | Brandt | CS-319 | | Kim | EE-181 | +------------+-----------+ 15 rows in set (0.079 sec) MariaDB [sksunivdemo]> describe course; +-----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+--------------+------+-----+---------+-------+ | course_id | varchar(8) | NO | PRI | NULL | | | title | varchar(50) | YES | | NULL | | | dept_name | varchar(20) | YES | MUL | NULL | | | credits | decimal(2,0) | YES | | NULL | | +-----------+--------------+------+-----+---------+-------+ 4 rows in set (0.083 sec) MariaDB [sksunivdemo]> select name, title from instructor, teaches, course where instructor.ID = teaches.ID and teaches.course_id = course.course_id; +------------+----------------------------+ | name | title | +------------+----------------------------+ | Srinivasan | Intro. to Computer Science | | Srinivasan | Robotics | | Srinivasan | Database System Concepts | | Wu | Investment Banking | | Mozart | Music Video Production | | Einstein | Physical Principles | | El Said | World History | | Katz | Intro. to Computer Science | | Katz | Image Processing | | Crick | Intro. to Biology | | Crick | Genetics | | Brandt | Game Design | | Brandt | Game Design | | Brandt | Image Processing | | Kim | Intro. to Digital Systems | +------------+----------------------------+ 15 rows in set (0.082 sec) MariaDB [sksunivdemo]> select * from instructor, teaches, course where instructor.ID = teaches.ID and teaches.course_id = course.course_id; +-------+------------+------------+----------+-------+-----------+--------+----------+------+-----------+----------------------------+------------+---------+ | ID | name | dept_name | salary | ID | course_id | sec_id | semester | year | course_id | title | dept_name | credits | +-------+------------+------------+----------+-------+-----------+--------+----------+------+-----------+----------------------------+------------+---------+ | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-101 | 1 | Fall | 2017 | CS-101 | Intro. to Computer Science | Comp. Sci. | 4 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-315 | 1 | Spring | 2018 | CS-315 | Robotics | Comp. Sci. | 3 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | 10101 | CS-347 | 1 | Fall | 2017 | CS-347 | Database System Concepts | Comp. Sci. | 3 | | 12121 | Wu | Finance | 90000.00 | 12121 | FIN-201 | 1 | Spring | 2018 | FIN-201 | Investment Banking | Finance | 3 | | 15151 | Mozart | Music | 40000.00 | 15151 | MU-199 | 1 | Spring | 2018 | MU-199 | Music Video Production | Music | 3 | | 22222 | Einstein | Physics | 95000.00 | 22222 | PHY-101 | 1 | Fall | 2017 | PHY-101 | Physical Principles | Physics | 4 | | 32343 | El Said | History | 60000.00 | 32343 | HIS-351 | 1 | Spring | 2018 | HIS-351 | World History | History | 3 | | 45565 | Katz | Comp. Sci. | 75000.00 | 45565 | CS-101 | 1 | Spring | 2018 | CS-101 | Intro. to Computer Science | Comp. Sci. | 4 | | 45565 | Katz | Comp. Sci. | 75000.00 | 45565 | CS-319 | 1 | Spring | 2018 | CS-319 | Image Processing | Comp. Sci. | 3 | | 76766 | Crick | Biology | 72000.00 | 76766 | BIO-101 | 1 | Summer | 2017 | BIO-101 | Intro. to Biology | Biology | 4 | | 76766 | Crick | Biology | 72000.00 | 76766 | BIO-301 | 1 | Summer | 2018 | BIO-301 | Genetics | Biology | 4 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 83821 | CS-190 | 1 | Spring | 2017 | CS-190 | Game Design | Comp. Sci. | 4 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 83821 | CS-190 | 2 | Spring | 2017 | CS-190 | Game Design | Comp. Sci. | 4 | | 83821 | Brandt | Comp. Sci. | 92000.00 | 83821 | CS-319 | 2 | Spring | 2018 | CS-319 | Image Processing | Comp. Sci. | 3 | | 98345 | Kim | Elec. Eng. | 80000.00 | 98345 | EE-181 | 1 | Spring | 2017 | EE-181 | Intro. to Digital Systems | Elec. Eng. | 3 | +-------+------------+------------+----------+-------+-----------+--------+----------+------+-----------+----------------------------+------------+---------+ 15 rows in set (0.079 sec) MariaDB [sksunivdemo]> select T1.ID from teaches as T1, teaches as T2 where T1.ID = T2.ID and T1.course_id <> T2.course_id; +-------+ | ID | +-------+ | 10101 | | 10101 | | 10101 | | 10101 | | 10101 | | 10101 | | 45565 | | 45565 | | 76766 | | 76766 | | 83821 | | 83821 | | 83821 | | 83821 | +-------+ 14 rows in set (0.077 sec) MariaDB [sksunivdemo]> select distinct T1.ID from teaches as T1, teaches as T2 where T1.ID = T2.ID and T1.course_id <> T2.course_id; +-------+ | ID | +-------+ | 10101 | | 45565 | | 76766 | | 83821 | +-------+ 4 rows in set (0.001 sec) MariaDB [sksunivdemo]> select distinct ID from teaches as T1, teaches as T2 where T1.ID = T2.ID and T1.course_id <> T2.course_id; ERROR 1052 (23000): Column 'ID' in field list is ambiguous MariaDB [sksunivdemo]> (select course_id from section where semester = 'Fall' and year = '2017') union (select course_id from section where semester = 'Spring' and year = '2018'); +-----------+ | course_id | +-----------+ | CS-101 | | CS-347 | | PHY-101 | | FIN-201 | | MU-199 | | HIS-351 | | CS-319 | | CS-315 | +-----------+ 8 rows in set (0.084 sec) MariaDB [sksunivdemo]> select course_id from section where (semester = 'Fall' and year = '2017') or (semester = 'Spring' and year = '2018'); +-----------+ | course_id | +-----------+ | CS-101 | | CS-101 | | FIN-201 | | MU-199 | | HIS-351 | | CS-319 | | CS-347 | | CS-319 | | PHY-101 | | CS-315 | +-----------+ 10 rows in set (0.001 sec) MariaDB [sksunivdemo]> select course_id from section where (semester = 'Fall' and year = '2017') and (semester = 'Spring' and year = '2018'); Empty set (0.001 sec) MariaDB [sksunivdemo]> (select course_id from section -> where sem = 'Fall' -> and year = '2017') -> intersect -> (select course_id from section -> where sem = 'Spring' -> and year = '2018'); ERROR 1054 (42S22): Unknown column 'sem' in 'where clause' MariaDB [sksunivdemo]> (select course_id from section where semester = 'Fall' and year = '2017') intersect (select course_id from section where semester = 'Spring' and year = '2018'); +-----------+ | course_id | +-----------+ | CS-101 | +-----------+ 1 row in set (0.079 sec) MariaDB [sksunivdemo]> (select course_id from section where semester = 'Fall' and year = '2017') except (select course_id from section where semester = 'Spring' and year = '2018'); +-----------+ | course_id | +-----------+ | CS-347 | | PHY-101 | +-----------+ 2 rows in set (0.001 sec) MariaDB [sksunivdemo]> select count(name) from instructor; +-------------+ | count(name) | +-------------+ | 12 | +-------------+ 1 row in set (0.001 sec) MariaDB [sksunivdemo]> select count(*) from instructor; +----------+ | count(*) | +----------+ | 12 | +----------+ 1 row in set (0.001 sec) MariaDB [sksunivdemo]> select count(dept_name) from instructor; +------------------+ | count(dept_name) | +------------------+ | 12 | +------------------+ 1 row in set (0.001 sec) MariaDB [sksunivdemo]> select count(distinct dept_name) from instructor; +---------------------------+ | count(distinct dept_name) | +---------------------------+ | 7 | +---------------------------+ 1 row in set (0.001 sec) MariaDB [sksunivdemo]> select count(distinct dept_name) as dept_count from instructor; +------------+ | dept_count | +------------+ | 7 | +------------+ 1 row in set (0.001 sec) MariaDB [sksunivdemo]> select avg(salary) from instructor where dept_name = 'Comp. Sci.'; +--------------+ | avg(salary) | +--------------+ | 77333.333333 | +--------------+ 1 row in set (0.001 sec) MariaDB [sksunivdemo]> select avg(salary) from instructor; +--------------+ | avg(salary) | +--------------+ | 74833.333333 | +--------------+ 1 row in set (0.001 sec) MariaDB [sksunivdemo]> select count(salary),avg(salary) from instructor; +---------------+--------------+ | count(salary) | avg(salary) | +---------------+--------------+ | 12 | 74833.333333 | +---------------+--------------+ 1 row in set (0.001 sec) MariaDB [sksunivdemo]> select count(salary),sum(salary),avg(salary) from instructor; +---------------+-------------+--------------+ | count(salary) | sum(salary) | avg(salary) | +---------------+-------------+--------------+ | 12 | 898000.00 | 74833.333333 | +---------------+-------------+--------------+ 1 row in set (0.001 sec) MariaDB [sksunivdemo]> select salary,salary/12 from instructor; +----------+-------------+ | salary | salary/12 | +----------+-------------+ | 65000.00 | 5416.666667 | | 90000.00 | 7500.000000 | | 40000.00 | 3333.333333 | | 95000.00 | 7916.666667 | | 60000.00 | 5000.000000 | | 87000.00 | 7250.000000 | | 75000.00 | 6250.000000 | | 62000.00 | 5166.666667 | | 80000.00 | 6666.666667 | | 72000.00 | 6000.000000 | | 92000.00 | 7666.666667 | | 80000.00 | 6666.666667 | +----------+-------------+ 12 rows in set (0.001 sec) MariaDB [sksunivdemo]> select avg(salary,salary/12) from instructor; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'salary/12) from instructor' at line 1 MariaDB [sksunivdemo]> select avg(salary),avg(salary/12) from instructor; +--------------+-----------------+ | avg(salary) | avg(salary/12) | +--------------+-----------------+ | 74833.333333 | 6236.1111111108 | +--------------+-----------------+ 1 row in set (0.001 sec) MariaDB [sksunivdemo]> select max(salary) from instructor; +-------------+ | max(salary) | +-------------+ | 95000.00 | +-------------+ 1 row in set (0.080 sec) MariaDB [sksunivdemo]> select name,max(salary) from instructor; +------------+-------------+ | name | max(salary) | +------------+-------------+ | Srinivasan | 95000.00 | +------------+-------------+ 1 row in set (0.001 sec) MariaDB [sksunivdemo]> select max(name) from instructor; +-----------+ | max(name) | +-----------+ | Wu | +-----------+ 1 row in set (0.001 sec) MariaDB [sksunivdemo]> select min(name) from instructor; +-----------+ | min(name) | +-----------+ | Brandt | +-----------+ 1 row in set (0.000 sec) MariaDB [sksunivdemo]> select avg(name) from instructor; +-----------+ | avg(name) | +-----------+ | 0 | +-----------+ 1 row in set, 12 warnings (0.080 sec) MariaDB [sksunivdemo]> select name,salary from instructor where salary = max(salary); ERROR 1111 (HY000): Invalid use of group function MariaDB [sksunivdemo]> select dept_name,avg(salary) -> from instructor -> group by dept_name; +------------+--------------+ | dept_name | avg(salary) | +------------+--------------+ | Biology | 72000.000000 | | Comp. Sci. | 77333.333333 | | Elec. Eng. | 80000.000000 | | Finance | 85000.000000 | | History | 61000.000000 | | Music | 40000.000000 | | Physics | 91000.000000 | +------------+--------------+ 7 rows in set (0.001 sec) MariaDB [sksunivdemo]> select dept_name,min(salary) from instructor group by dept_name; +------------+-------------+ | dept_name | min(salary) | +------------+-------------+ | Biology | 72000.00 | | Comp. Sci. | 65000.00 | | Elec. Eng. | 80000.00 | | Finance | 80000.00 | | History | 60000.00 | | Music | 40000.00 | | Physics | 87000.00 | +------------+-------------+ 7 rows in set (0.001 sec) MariaDB [sksunivdemo]> select dept_name,max(salary) from instructor group by dept_name; +------------+-------------+ | dept_name | max(salary) | +------------+-------------+ | Biology | 72000.00 | | Comp. Sci. | 92000.00 | | Elec. Eng. | 80000.00 | | Finance | 90000.00 | | History | 62000.00 | | Music | 40000.00 | | Physics | 95000.00 | +------------+-------------+ 7 rows in set (0.001 sec) MariaDB [sksunivdemo]> select ID,dept_name,max(salary) from instructor group by dept_name; +-------+------------+-------------+ | ID | dept_name | max(salary) | +-------+------------+-------------+ | 76766 | Biology | 72000.00 | | 10101 | Comp. Sci. | 92000.00 | | 98345 | Elec. Eng. | 80000.00 | | 12121 | Finance | 90000.00 | | 32343 | History | 62000.00 | | 15151 | Music | 40000.00 | | 22222 | Physics | 95000.00 | +-------+------------+-------------+ 7 rows in set (0.000 sec) MariaDB [sksunivdemo]> select ID,dept_name,max(salary) from instructor group by ID; +-------+------------+-------------+ | ID | dept_name | max(salary) | +-------+------------+-------------+ | 10101 | Comp. Sci. | 65000.00 | | 12121 | Finance | 90000.00 | | 15151 | Music | 40000.00 | | 22222 | Physics | 95000.00 | | 32343 | History | 60000.00 | | 33456 | Physics | 87000.00 | | 45565 | Comp. Sci. | 75000.00 | | 58583 | History | 62000.00 | | 76543 | Finance | 80000.00 | | 76766 | Biology | 72000.00 | | 83821 | Comp. Sci. | 92000.00 | | 98345 | Elec. Eng. | 80000.00 | +-------+------------+-------------+ 12 rows in set (0.000 sec) MariaDB [sksunivdemo]> select ID,dept_name,max(salary) from instructor group by name; +-------+------------+-------------+ | ID | dept_name | max(salary) | +-------+------------+-------------+ | 83821 | Comp. Sci. | 92000.00 | | 58583 | History | 62000.00 | | 76766 | Biology | 72000.00 | | 22222 | Physics | 95000.00 | | 32343 | History | 60000.00 | | 33456 | Physics | 87000.00 | | 45565 | Comp. Sci. | 75000.00 | | 98345 | Elec. Eng. | 80000.00 | | 15151 | Music | 40000.00 | | 76543 | Finance | 80000.00 | | 10101 | Comp. Sci. | 65000.00 | | 12121 | Finance | 90000.00 | +-------+------------+-------------+ 12 rows in set (0.080 sec) MariaDB [sksunivdemo]> select ID,name,dept_name,max(salary) from instructor group by name; +-------+------------+------------+-------------+ | ID | name | dept_name | max(salary) | +-------+------------+------------+-------------+ | 83821 | Brandt | Comp. Sci. | 92000.00 | | 58583 | Califieri | History | 62000.00 | | 76766 | Crick | Biology | 72000.00 | | 22222 | Einstein | Physics | 95000.00 | | 32343 | El Said | History | 60000.00 | | 33456 | Gold | Physics | 87000.00 | | 45565 | Katz | Comp. Sci. | 75000.00 | | 98345 | Kim | Elec. Eng. | 80000.00 | | 15151 | Mozart | Music | 40000.00 | | 76543 | Singh | Finance | 80000.00 | | 10101 | Srinivasan | Comp. Sci. | 65000.00 | | 12121 | Wu | Finance | 90000.00 | +-------+------------+------------+-------------+ 12 rows in set (0.001 sec) MariaDB [sksunivdemo]> select ID,dept_name,max(salary) from instructor group by dept_name; +-------+------------+-------------+ | ID | dept_name | max(salary) | +-------+------------+-------------+ | 76766 | Biology | 72000.00 | | 10101 | Comp. Sci. | 92000.00 | | 98345 | Elec. Eng. | 80000.00 | | 12121 | Finance | 90000.00 | | 32343 | History | 62000.00 | | 15151 | Music | 40000.00 | | 22222 | Physics | 95000.00 | +-------+------------+-------------+ 7 rows in set (0.001 sec) MariaDB [sksunivdemo]> select dept_name,avg(salary) from instructor group by dept_name having max(salary) > 80000; +------------+--------------+ | dept_name | avg(salary) | +------------+--------------+ | Comp. Sci. | 77333.333333 | | Finance | 85000.000000 | | Physics | 91000.000000 | +------------+--------------+ 3 rows in set (0.079 sec) MariaDB [sksunivdemo]> select dept_name,avg(salary) from instructor group by dept_name having dept_name = 'Physics'; +-----------+--------------+ | dept_name | avg(salary) | +-----------+--------------+ | Physics | 91000.000000 | +-----------+--------------+ 1 row in set (0.079 sec) MariaDB [sksunivdemo]> select dept_name,avg(salary) from instructor group by dept_name having dept_name = 'Physics' or dept_name = "Comp. Sci."; +------------+--------------+ | dept_name | avg(salary) | +------------+--------------+ | Comp. Sci. | 77333.333333 | | Physics | 91000.000000 | +------------+--------------+ 2 rows in set (0.001 sec) MariaDB [sksunivdemo]> select dept_name,avg(salary) from instructor where dept_name = 'Physics' or dept_name = 'Comp. Sc.' group by dept_name ; +-----------+--------------+ | dept_name | avg(salary) | +-----------+--------------+ | Physics | 91000.000000 | +-----------+--------------+ 1 row in set (0.001 sec) MariaDB [sksunivdemo]> select dept_name,avg(salary) from instructor where dept_name = 'Physics' or dept_name = 'Comp. Sci.' group by dept_name ; +------------+--------------+ | dept_name | avg(salary) | +------------+--------------+ | Comp. Sci. | 77333.333333 | | Physics | 91000.000000 | +------------+--------------+ 2 rows in set (0.001 sec) MariaDB [sksunivdemo]> select semester,year,count(*) from section group by semester,year; +----------+------+----------+ | semester | year | count(*) | +----------+------+----------+ | Fall | 2017 | 3 | | Spring | 2017 | 3 | | Spring | 2018 | 7 | | Summer | 2017 | 1 | | Summer | 2018 | 1 | +----------+------+----------+ 5 rows in set (0.001 sec) MariaDB [sksunivdemo]> use ipldb; 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 [ipldb]> select city,count(*) from ipltable group by city; +----------------+----------+ | city | count(*) | +----------------+----------+ | Abu Dhabi | 37 | | Ahmedabad | 36 | | Bangalore | 65 | | Bengaluru | 29 | | Bloemfontein | 2 | | Cape Town | 7 | | Centurion | 12 | | Chandigarh | 61 | | Chennai | 85 | | Cuttack | 7 | | Delhi | 90 | | Dharamsala | 13 | | Dubai | 13 | | Durban | 15 | | East London | 3 | | Guwahati | 3 | | Hyderabad | 77 | | Indore | 9 | | Jaipur | 57 | | Johannesburg | 8 | | Kanpur | 4 | | Kimberley | 3 | | Kochi | 5 | | Kolkata | 93 | | Lucknow | 14 | | Mohali | 5 | | Mumbai | 173 | | NA | 51 | | Nagpur | 3 | | Navi Mumbai | 9 | | Port Elizabeth | 7 | | Pune | 51 | | Raipur | 6 | | Rajkot | 10 | | Ranchi | 7 | | Sharjah | 10 | | Visakhapatnam | 15 | +----------------+----------+ 37 rows in set (0.092 sec) MariaDB [ipldb]> select city,count(*) from ipltable group by city order by city; +----------------+----------+ | city | count(*) | +----------------+----------+ | Abu Dhabi | 37 | | Ahmedabad | 36 | | Bangalore | 65 | | Bengaluru | 29 | | Bloemfontein | 2 | | Cape Town | 7 | | Centurion | 12 | | Chandigarh | 61 | | Chennai | 85 | | Cuttack | 7 | | Delhi | 90 | | Dharamsala | 13 | | Dubai | 13 | | Durban | 15 | | East London | 3 | | Guwahati | 3 | | Hyderabad | 77 | | Indore | 9 | | Jaipur | 57 | | Johannesburg | 8 | | Kanpur | 4 | | Kimberley | 3 | | Kochi | 5 | | Kolkata | 93 | | Lucknow | 14 | | Mohali | 5 | | Mumbai | 173 | | NA | 51 | | Nagpur | 3 | | Navi Mumbai | 9 | | Port Elizabeth | 7 | | Pune | 51 | | Raipur | 6 | | Rajkot | 10 | | Ranchi | 7 | | Sharjah | 10 | | Visakhapatnam | 15 | +----------------+----------+ 37 rows in set (0.013 sec) MariaDB [ipldb]> select city,count(*) from ipltable group by city order by city desc; +----------------+----------+ | city | count(*) | +----------------+----------+ | Visakhapatnam | 15 | | Sharjah | 10 | | Ranchi | 7 | | Rajkot | 10 | | Raipur | 6 | | Pune | 51 | | Port Elizabeth | 7 | | Navi Mumbai | 9 | | Nagpur | 3 | | NA | 51 | | Mumbai | 173 | | Mohali | 5 | | Lucknow | 14 | | Kolkata | 93 | | Kochi | 5 | | Kimberley | 3 | | Kanpur | 4 | | Johannesburg | 8 | | Jaipur | 57 | | Indore | 9 | | Hyderabad | 77 | | Guwahati | 3 | | East London | 3 | | Durban | 15 | | Dubai | 13 | | Dharamsala | 13 | | Delhi | 90 | | Cuttack | 7 | | Chennai | 85 | | Chandigarh | 61 | | Centurion | 12 | | Cape Town | 7 | | Bloemfontein | 2 | | Bengaluru | 29 | | Bangalore | 65 | | Ahmedabad | 36 | | Abu Dhabi | 37 | +----------------+----------+ 37 rows in set (0.016 sec)