Review Hands On Exercise 1 - SQL With Answers
Review Hands On Exercise 1 - SQL With Answers
12, 2021
ISB21C – HANDS ON EXERCISE 2
A. PREPARATION
1. Download the two files attached to this assignment: Create Sample HR Database SQL
and Insert HR Data SQL.
2. In phpmyAdmin, create a new database ISB21Sample
3. On the SQL tab, copy and paste the SQL commands found under Create Sample HR
Database SQL.doc and click Go.
4. The tables should now be created inside ISB21Sample database
5. On the SQL tab again, copy and paste the SQL commands found under Insert HR Data
SQL.doc and click Go.
6. The data should now be loaded into their individual tables.
7. Perform the following actions and answer the questions found in each number.
B. TAKING ACTION.
1) Display all records per table. Write the correct SQL command used for each table.
Countries = 25
Departments = 11
Dependents = 30
Employees = 40
Jobs = 19
Locations = 7
Regions = 4
3) Display only countries (countryname) which starts with A, S, & Z. Write the correct SQL
command.
SELECT country_name FROM countries WHERE country_name like 'A%' OR
country_name LIKE 'S%' OR country_name LIKE 'Z%';
5) Display all employees whose hire date is after March 30, 1998. Follow the format shown
in the table. Write the correct SQL command.
Diana Lorentz
8) Display all employees (first name, last name, department name) who belong to the IT
department.
**To get data from more than one table, separate them with a comma ( , ).
** To specify which field are your referring to, precede the fieldname with the table
name where it belongs followed by a period (.) ex. Course.id
Write the SQL command here.
9) Insert the screenshot of your result. What is the 3rd record on the list?
3rd record on the list: David Austin
10) Display all firstname, lastname, and job title of employees who are managers (regardless
of the department). Write the SQL command. Attach the screenshot of the results.
11) Display the highest paying employee in the company. (first name, last name, salary).
Write the SQL command. Use the MAX function.
**You may nest SQL statements (SQL statement inside another SQL statement)
SELECT first_name, last_name, salary FROM employees WHERE salary = (SELECT
max(salary) FROM employees);
13) Insert your details inside the Dependents table under your chosen Employee. Write your
SQL command.
INSERT INTO command here
14) Change Purchasing Clerk to Purchasing Officer. Write the SQL command.