wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

ITPC 116 Section 6

Total questions: 10

Worksheet time: 11mins

Name
Class
Date
1.

The join column must be included in the select statement when you use the NATURAL JOIN clause. 

a)

True

b)

False

2.

Which of the following conditions will cause an error on a NATURAL JOIN?

a)

When you attempt to use two tables that have a common field.

b)

When the NATURAL JOIN clause is based on all columns in the two tables that have the same name.

c)

If it selects rows from the two tables that have equal values in all matched columns.

d)

If the columns having the same names have different data types.

3.

A NATURAL JOIN is based on:

a)

Columns with the same name and datatype

b)

Columns with the same name

c)

Columns with the same datatype and width

d)

Tables with the same structure

4.

Given the following descriptions of the employees and jobs tables, which of the following scripts will display each employee's possible minimum and maximum salaries based on their job title?

a)

SELECT employees.first_name, employees.last_name, employees.job_id, jobs.min_salary, jobs.max_salary 

FROM employees 

NATURAL JOIN jobs 

USING (job_id);

b)

SELECT first_name, last_name, job_id, min_salary, max_salary 

FROM employees 

NATURAL JOIN jobs;

c)

SELECT employees.first_name, employees.last_name, employees.job_id, jobs.min_salary, jobs.max_salary 

FROM employees 

NATURAL JOIN jobs;

d)

SELECT first_name, last_name, job_id, min_salary, max_salary 

FROM employees 

FULL JOIN jobs (job_id);

e)

SELECT employees.first_name, employees.last_name, employees.job_id, jobs.min_salary, jobs.max_salary 

FROM employees 

NATURAL JOIN jobs ON (employees.job_title = jobs.job_title);

5.

Which query represents the correct syntax for a left outer join?

a)

SELECT companyname, orderdate, total 

FROM customers 

LEFT JOIN orders 

ON customers.cust_id = orders.cust_id;

b)

SELECT companyname, orderdate, total 

FROM customers 

OUTER JOIN orders 

ON customers.cust_id = orders.cust_id;

c)

SELECT companyname, orderdate, total 

FROM customers 

LEFT OUTER JOIN orders 

ON customers.cust_id = orders.cust_id;

d)

SELECT companyname, orderdate, total 

FROM customers 

LEFT OUTER orders 

ON customers.cust_id = orders.cust_id;

6.

A query is needed to display each department and its manager name from the above tables. However, not all departments have a manager but we want departments returned in all cases. Which of the following SQL: 1999 syntax scripts will accomplish the task?

a)

SELECT departments.department_id, employees.first_name, employees.last_name 

FROM employees 

RIGHT OUTER JOIN departments 

ON (employees.employee_id = departments.manager_id);

b)

SELECT departments.department_id, employees.first_name, employees.last_name 

FROM employees 

LEFT OUTER JOIN departments 

WHERE (employees.department_id = departments.department_id);

c)

SELECT departments.department_id, employees.first_name, employees.last_name 

FROM employees 

FULL OUTER JOIN departments 

ON (employees.employee_id = departments.manager_id);

d)

SELECT departments.department_id, employees.first_name, employees.last_name 

FROM employees , departments 

WHERE employees.employee_id 

RIGHT OUTER JOIN departments.manager_id;

7.

The following statement is an example of what kind of join?

SELECT car.vehicle_id, driver.name FROM car LEFT OUTER JOIN driver ON (driver_id) ;

a)

Inner Join

b)

Outer Join

c)

Equijoin

d)

Optimal Join

8.

Which statement about a self join is true?

a)

The NATURAL JOIN clause must be used.

b)

Table aliases must be used to qualify table names.

c)

Table aliases cannot be used to qualify table names.

d)

A self join must be implemented by defining a view.

9.

Evaluate this SELECT statement:

SELECT * FROM employee worker JOIN employee manager ON worker.mgr_id = manager.emp_id; Which type of join is created by this SELECT statement?

a)

a self join

b)

a cross join

c)

a left outer join

d)

a full outer join

10.

Which select statement will return the last name and hire date of an employee and his/ her manager for employees that started in the company before their managers?

a)

SELECT worker.last_name, worker.hire_date, manager.last_name, m.hire_date 

FROM employees worker JOIN employees manager 

ON worker.manager_id = manager.employee_id 

WHERE worker.hire_date < manager.hire_date 

b)

SELECT worker.last_name, worker.hire_date, manager.last_name, manager.hire_date 

FROM employees worker JOIN employees manager 

ON worker.manager_id = manager.employee_id 

WHERE worker.hire_date > manager.hire_date

c)

SELECT worker.last_name, worker.hire_date, manager.last_name, manager.hire_date 

FROM employees worker JOIN employees worker 

ON worker.manager_id = worker.employee_id 

WHERE worker.hire_date < worker.hire_date

d)

SELECT worker.last_name, worker.hire_date, manager.last_name, manager.hire_date 

FROM employees worker JOIN employees manager 

ON worker.manager_id != manager.employee_id 

WHERE worker.hire_date < manager.hire_date