Brijeshs-MacBook-Pro:~ brijeshkuvadiya$ mysql -u root -p
Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 Server version: 8.0.13 MySQL Community Server - GPL
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> select department_name, street_address, postal_code, city, state_province
from mach1.department_master46, mach1.location_master46 where department_master46.location_id = location_master46.location_id; +-----------------+------------------------------------------+------------- +---------------------+----------------+ | department_name | street_address | postal_code | city | state_province | +-----------------+------------------------------------------+------------- +---------------------+----------------+ | Human Resources | 2004 Charade Rd | 98199 | Washington | Washington | | Shipping | 2011 Interiors Blvd | 99236 | South San Francisco | California | | Shipping | 2013 Interiors Blvd | 99236 | South San Francisco | California | | IT | 2014 Jabberwocky Rd | 26192 | Southlake | Texas | | Sales | Magdalen Center, The oxford science park | OX9 9ZB | Oxford | Oxford | | Executive | 2004 Charade Rd | 98199 | Washington | Washington | | Contracting | 2004 Charade Rd | 98199 | Washington | Washington | +-----------------+------------------------------------------+------------- +---------------------+----------------+ 7 rows in set (0.00 sec) mysql> select department_name, country_name, region_name from mach1.department_master46, mach1.location_master46, mach1.region_master46, mach1.country_master46 where department_master46.location_id = location_master46.location_id and location_master46.country_id = country_master46.country_id and country_master46.region_id = region_master46.region_id; +-----------------+--------------------------+-------------+ | department_name | country_name | region_name | +-----------------+--------------------------+-------------+ | Human Resources | United States of America | Americas | | Shipping | United States of America | Americas | | Shipping | United States of America | Americas | | IT | United States of America | Americas | | Sales | United Kingdom | Europe | | Executive | United States of America | Americas | | Contracting | United States of America | Americas | +-----------------+--------------------------+-------------+ 7 rows in set (0.01 sec)
mysql> select department_name, street_address, postal_code, city, state_province
from mach1.department_master46, mach1.location_master46 where department_master46.location_id = location_master46.location_id; +-----------------+------------------------------------------+------------- +---------------------+----------------+ | department_name | street_address | postal_code | city | state_province | +-----------------+------------------------------------------+------------- +---------------------+----------------+ | Human Resources | 2004 Charade Rd | 98199 | Washington | Washington | | Shipping | 2011 Interiors Blvd | 99236 | South San Francisco | California | | Shipping | 2013 Interiors Blvd | 99236 | South San Francisco | California | | IT | 2014 Jabberwocky Rd | 26192 | Southlake | Texas | | Sales | Magdalen Center, The oxford science park | OX9 9ZB | Oxford | Oxford | | Executive | 2004 Charade Rd | 98199 | Washington | Washington | | Contracting | 2004 Charade Rd | 98199 | Washington | Washington | +-----------------+------------------------------------------+------------- +---------------------+----------------+ 7 rows in set (0.00 sec)
mysql> select e.employee_id, e.first_name, e.manager_id, m.first_name as
'Manager_name' from mach1.employee_master46 e, mach1.employee_master46 m where e.manager_id = m.employee_id; +-------------+------------+------------+--------------+ | employee_id | first_name | manager_id | Manager_name | +-------------+------------+------------+--------------+ | 200 | Jennifer | 200 | Jennifer | | 201 | Michael | 201 | Michael | | 202 | Pat | 201 | Michael | | 205 | Shelly | 205 | Shelly | | 206 | William | 205 | Shelly | | 7 | Raj | 7 | Raj | | 101 | Neena | 7 | Raj | | 102 | Lex | 7 | Raj | | 103 | Alexander | 103 | Alexander | | 104 | Bruce | 103 | Alexander | | 107 | Diana | 103 | Alexander | | 124 | Kevin | 124 | Kevin | | 141 | Trenna | 124 | Kevin | | 142 | Curtis | 124 | Kevin | | 143 | Randall | 124 | Kevin | | 144 | Peter | 124 | Kevin | | 149 | Eleni | 149 | Eleni | | 178 | Kimberely | 149 | Eleni | +-------------+------------+------------+--------------+ 18 rows in set (0.00 sec)
mysql> select first_name, grade_level from mach1.employee_master46 join
mach1.job_grade_master46 ON(salary between mach1.job_grade_master46.LOWEST_SAL and mach1.JOb_grade_master46.Highest_SAL and manager_id = "124"); +------------+-------------+ | first_name | grade_level | +------------+-------------+ | Randall | A | | Peter | A | | Kevin | B | | Trenna | B | | Curtis | B | +------------+-------------+ 5 rows in set (0.00 sec)
mysql> select last_name, job_title as "JOB", employee_master46.department_id,
department_master46.department_name from mach1.employee_master46, mach1.department_master46, mach1.location_master46, mach1.job_master46 where employee_master46.department_id = department_master46.department_id and department_master46.location_id = location_master46.location_id and location_master46.city = "Oxford" and employee_master46.job_id = job_master46.job_id; +-----------+----------------------+---------------+-----------------+ | last_name | JOB | department_id | department_name | +-----------+----------------------+---------------+-----------------+ | Zlotkey | General Manager | 80 | Sales | | Grant | Sales Representative | 80 | Sales | +-----------+----------------------+---------------+-----------------+ 2 rows in set (0.01 sec)
mysql> select e.employee_id, e.last_name, m.last_name as "Manager's Last Name",
mysql> select department_master46.department_name, region_name from
mach1.department_master46, mach1.location_master46, mach1.country_master46, mach1.region_master46 where department_master46.location_id = location_master46.location_id and location_master46.country_id = country_master46.country_id and country_master46.region_id = region_master46.region_id and region_name = "Europe"; +-----------------+-------------+ | department_name | region_name | +-----------------+-------------+ | Sales | Europe | +-----------------+-------------+ 1 row in set (0.00 sec)
mysql> select concat(first_name, " ",last_name) as "Employee_Name" , max_salary
from mach1.employee_master46, mach1.job_master46 where first_name = "Peter" and last_name = "Vargas" and employee_master46.job_id = job_master46.job_id; +---------------+------------+ | Employee_Name | max_salary | +---------------+------------+ | Peter Vargas | 5000 | +---------------+------------+ 1 row in set (0.00 sec)
mysql> select last_name, department_master46.department_id from
mach1.employee_master46, mach1.location_master46, mach1.department_master46, mach1.country_master46 where employee_master46.department_id = department_Master46.department_id and department_Master46.location_id = location_master46.location_id and location_master46.country_id = country_Master46.country_id and country_name = "United States of America"; +-----------+---------------+ | last_name | department_id | +-----------+---------------+ | Whalen | 10 | | Aryan | 10 | | Kochhar | 10 | | De Haan | 10 | | Hunold | 60 | | Ernst | 60 | | Lorentz | 60 | | Mourgos | 90 | | Rajs | 90 | | Davies | 90 | | Matos | 90 | | Vargas | 90 | +-----------+---------------+ 12 rows in set (0.00 sec)
mysql> SELECT concat(first_name, " " , last_name) as "Employee_name", hire_rate as
"Hire Date" FROM mach1.Employee_MASTER46 where hire_rate > '1999-05-07' order by hire_rate; +-------------------+------------+ | Employee_name | Hire Date | +-------------------+------------+ | Bruce Ernst | 1999-06-09 | | Michael Hartstein | 1999-12-11 | | Pat Fay | 2000-01-02 | | Neena Kochhar | 2010-05-07 | | Diana Lorentz | 2012-03-07 | | Jennifer Whalen | 2012-12-12 | | Raj Aryan | 2017-06-08 | +-------------------+------------+ 7 rows in set (0.00 sec)
mysql> select concat(e.first_name, " ", e.last_name) as "Employee" , e.hire_rate
as "Emp Hired" , concat( m.first_name, " " , m.last_name) as "Manager", m.hire_rate as "Manager Hired" from mach1.employee_master46 e, mach1.employee_master46 m where e.manager_id = m.employee_id and e.hire_rate < m.hire_rate ; +-----------------+------------+----------------+---------------+ | Employee | Emp Hired | Manager | Manager Hired | +-----------------+------------+----------------+---------------+ | William Gietz | 1983-05-07 | Shelly Higgins | 1987-04-05 | | Neena Kochhar | 2010-05-07 | Raj Aryan | 2017-06-08 | | Lex De Haan | 1997-06-07 | Raj Aryan | 2017-06-08 | | Randall Matos | 1995-02-07 | Kevin Mourgos | 1998-02-06 | | Peter Vargas | 1996-04-07 | Kevin Mourgos | 1998-02-06 | | Kimberely Grant | 1993-02-07 | Eleni Zlotkey | 1998-03-07 | +-----------------+------------+----------------+---------------+ 6 rows in set (0.00 sec)