SQL Programming #5

Oracle Database Programming with SQL Section 5

1.         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?
EMPLOYEES Table:
Name   Null?    Type
EMPLOYEE_ID          NOT NULL     NUMBER (6)
FIRST_NAME             VARCHAR2 (20)
LAST_NAME  NOT NULL     VARCHAR2 (25)
EMAIL NOT NULL     VARCHAR2 (25)
PHONE_NUMBER                  VARCHAR2 (20)
HIRE_DATE   NOT NULL     DATE
JOB_ID           NOT NULL     VARCHAR2 (10)
SALARY                     NUMBER (8,2)
COMMISSION_PCT                NUMBER (2,2)
MANAGER_ID                       NUMBER (6)
DEPARTMENT_ID                 NUMBER (4)
JOBS Table:
Name   Null?    Type
JOB_ID           NOT NULL     VARCHAR2 (10)
JOB_TITLE     NOT NULL     VARCHAR2 (35)
MIN_SALARY                        NUMBER (6)
MAX_SALARY                      NUMBER (6)
♦SELECT first_name, last_name, job_id, min_salary, max_salary
FROM employees
NATURAL JOIN jobs;
(*)
♦SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary
FROM employees e
NATURAL JOIN jobs j
USING (job_id);
♦SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary
FROM employees e
NATURAL JOIN jobs j;
♦SELECT first_name, last_name, job_id, min_salary, max_salary
FROM employees e
FULL JOIN jobs j (job_id);
♦SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary
FROM employees e
NATURAL JOIN jobs j ON (e.job_title = j.job_title);

2.         What is another name for a simple join or an inner join?
♦Equijoin (*)
♦Outer Join
♦Nonequijoin
♦Self Join

3.         You need to join the EMPLOYEE_HIST and EMPLOYEES tables. The EMPLOYEE_HIST table will be the first table in the FROM clause. All the matched and unmatched rows in the EMPLOYEES table need to be displayed. Which type of join will you use?
♦An inner join
♦A right outer join (*)
♦A cross join
♦A left outer join

4.         EMPLOYEES Table:
Name   Null?    Type
EMPLOYEE_ID          NOT NULL     NUMBER(6)
FIRST_NAME             VARCHAR2(20)
LAST_NAME  NOT NULL     VARCHAR2(25)
DEPARTMENT_ID                 NUMBER (4)
DEPARTMENTS Table:
Name   Null?    Type
DEPARTMENT_ID     NOT NULL     NUMBER 4
DEPARTMENT_NAME          NOT NULL     VARCHAR2(30)
MANAGER_ID                       NUMBER (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?
♦SELECT d.department_id, e.first_name, e.last_name
FROM employees e
RIGHT OUTER JOIN departments d
ON (e.employee_id = d.manager_id);
(*)
♦SELECT d.department_id, e.first_name, e.last_name
FROM employees e, departments d
WHERE e.employee_id
RIGHT OUTER JOIN d.manager_id;
♦SELECT d.department_id, e.first_name, e.last_name
FROM employees e
FULL OUTER JOIN departments d
ON (e.employee_id = d.manager_id);
♦SELECT d.department_id, e.first_name, e.last_name
FROM employees e
LEFT OUTER JOIN departments d
WHERE (e.department_id = d.department_id);

5.         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?
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees w
WHERE w.manager_id = w.employee_id
AND w.hire_date < w.hire_date
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees m
WHERE w.manager_id = m.employee_id
AND w.hire_date < m.hire_date
(*)
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees m
WHERE w.manager_id = m.employee_id
AND w.hire_date > m.hire_date
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees m
WHERE w.manager_id != m.employee_id
AND w.hire_date < m.hire_date

6.         Which statement about a self join is true?
♦A self join must be implemented by defining a view.
♦Table aliases must be used to qualify table names. (*)
♦The NATURAL JOIN clause must be used.
♦Table aliases cannot be used to qualify table names.

7.         Which of the following database design concepts do you need in your tables to write Hierarchical queries?
♦Arc
♦Recursive Relationship (*)
♦Non-Transferability
♦Supertype

8.         Evaluate this SELECT statement:
SELECT *
FROM employee e, employee m
WHERE e.mgr_id = m.emp_id;
Which type of join is created by this SELECT statement?
♦a full outer join
♦a left outer join
♦a cross join
♦a self join (*)

9.         Hierarchical queries MUST use the LEVEL pseudo column. True or False?
♦True
♦False (*)

10.       A join between tables where the result set includes matching values from both tables but does NOT return any unmatched rows could be called which of the following? (Choose three)
♦Full outer join
♦Equijoin (*)
♦Simple join (*)
♦Self join (*)
♦Nonequijoin

11.       A NATURAL JOIN is based on:
♦Columns with the same name
♦Columns with the same datatype and width
♦Columns with the same name and datatype (*)
♦Tables with the same structure

12.       You need to join two tables that have two columns with the same name, datatype, and precision. Which type of join would you create to join the tables on both of the columns?
♦Self-join
♦Cross join
♦Outer join
♦Natural join (*)

13.       For which condition would you use an equijoin query with the USING keyword?
♦The CUSTOMER and ORDER tables have no columns with identical names.
♦You need to perform a join of the CUSTOMER and ORDER tables but limit the number of columns in the join condition. (*)
♦The ORDER table contains a column that has a referential constraint to a column in the PRODUCT table.
♦The CUSTOMER and ORDER tables have a corresponding column, CUST_ID. The CUST_ID column in the ORDER table contains null values that need to be displayed.

14.       Table aliases MUST be used with columns referenced in the JOIN USING clause. True or False?
 ♦True
♦False (*)

15.       The keywords JOIN _____________ should be used to join tables with the same column names but different datatypes.
♦NATURAL ON
♦USING (*)
♦ON
♦WHEN

16.         You need to join two tables that have two columns with the same name, datatype, and precision. Which type of join would you create to join the tables on both of the columns?
♦Natural join (*)
♦Self-join
♦Cross join
♦Outer join

17.         A join between tables where the result set includes matching values from both tables but does NOT return any unmatched rows could be called which of the following? (Choose three)
♦Self join (*)
♦Full outer join
♦Nonequijoin
♦Simple join (*)
♦Equijoin (*)

18.         Which of the following conditions will cause an error on a NATURAL JOIN?
♦If the columns having the same names have different data types, then an error is returned. (*)
♦When you attempt to write it as an equijoin.
♦When the NATURAL JOIN clause is based on all columns in the two tables that have the same name.
♦If it selects rows from the two tables that have equal values in all matched columns.

19.         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?
EMPLOYEES Table:
Name   Null?    Type
EMPLOYEE_ID          NOT NULL     NUMBER (6)
FIRST_NAME             VARCHAR2 (20)
LAST_NAME  NOT NULL     VARCHAR2 (25)
EMAIL NOT NULL     VARCHAR2 (25)
PHONE_NUMBER                  VARCHAR2 (20)
HIRE_DATE   NOT NULL     DATE
JOB_ID           NOT NULL     VARCHAR2 (10)
SALARY                     NUMBER (8,2)
COMMISSION_PCT                NUMBER (2,2)
MANAGER_ID                       NUMBER (6)
DEPARTMENT_ID                 NUMBER (4)
JOBS Table:
Name   Null?    Type
JOB_ID           NOT NULL     VARCHAR2 (10)
JOB_TITLE     NOT NULL     VARCHAR2 (35)
MIN_SALARY                        NUMBER (6)
MAX_SALARY                      NUMBER (6)
♦SELECT first_name, last_name, job_id, min_salary, max_salary
FROM employees
NATURAL JOIN jobs;
(*)
♦SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary
FROM employees e
NATURAL JOIN jobs j
USING (job_id);
♦SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary
FROM employees e
NATURAL JOIN jobs j ON (e.job_title = j.job_title);
♦SELECT first_name, last_name, job_id, min_salary, max_salary
FROM employees e
FULL JOIN jobs j (job_id);
♦SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary
FROM employees e
NATURAL JOIN jobs j;

20.         Which query represents the correct syntax for a left outer join?
♦SELECT companyname, orderdate, total
FROM customers c
LEFT JOIN orders o
ON c.cust_id = o.cust_id;
♦SELECT companyname, orderdate, total
FROM customers c
LEFT OUTER orders o
ON c.cust_id = o.cust_id;
♦SELECT companyname, orderdate, total
FROM customers c
OUTER JOIN orders o
ON c.cust_id = o.cust_id;
♦SELECT companyname, orderdate, total
FROM customers c
LEFT OUTER JOIN orders o
ON c.cust_id = o.cust_id;
(*)

21.         Which query will retrieve all the rows in the EMPLOYEES table, even if there is no match in the DEPARTMENTS table?
♦SELECT e.last_name, e.department_id, d.department_name
FROM employees e
RIGHT OUTER JOIN departments d ON (e.department_id = d.department_id);
♦SELECT e.last_name, e.department_id, d.department_name
FROM employees e
JOIN departments d USING (e.department_id = d.department_id);
♦SELECT e.last_name, e.department_id, d.department_name
FROM employees e
LEFT OUTER JOIN departments d ON (e.department_id = d.department_id);
(*)
♦SELECT e.last_name, e.department_id, d.department_name
FROM employees e
NATURAL JOIN departments d;

22.         Which type of join returns rows from one table that have NO direct match in the other table?
♦Equijoin
♦Self join
♦Outer join (*)
♦Natural join

23.         The primary advantages of using JOIN ON is: (Select two)
♦The join happens automatically based on matching column names and data types.
♦It permits columns that don?t have matching data types to be joined. (*)
♦It permits columns with different names to be joined. (*)
♦It will display rows that do not meet the join condition.

24.         Table aliases MUST be used with columns referenced in the JOIN USING clause. True or False?
♦True
♦False (*)

25.       The primary advantage of using JOIN ON is:
♦It easily produces a Cartesian product between the tables in the statement.
♦The join happens automatically based on matching column names and data types.
♦It permits columns that don?t have matching data types to be joined.
♦It permits columns with different names to be joined. (*)
♦It will display rows that do not meet the join condition.

26.       Evaluate this SELECT statement:
SELECT *
FROM employee e, employee m
WHERE e.mgr_id = m.emp_id;
Which type of join is created by this SELECT statement?
♦a self join (*)
♦a full outer join
♦a left outer join
♦a cross join

27.       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?
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees m
WHERE w.manager_id != m.employee_id
AND w.hire_date < m.hire_date
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees m
WHERE w.manager_id = m.employee_id
AND w.hire_date > m.hire_date
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees m
WHERE w.manager_id = m.employee_id
AND w.hire_date < m.hire_date
(*)
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees w
WHERE w.manager_id = w.employee_id
AND w.hire_date < w.hire_date

28.       Which of the following database design concepts do you need in your tables to write Hierarchical queries?
♦Arc
♦Supertype
♦Recursive Relationship (*)
♦Non-Transferability

29.       Which statement about a self join is true?
♦Table aliases must be used to qualify table names. (*)
♦Table aliases cannot be used to qualify table names.
♦The NATURAL JOIN clause must be used.
♦A self join must be implemented by defining a view.

30.       Hierarchical queries MUST use the LEVEL pseudo column. True or False?
♦True
♦False (*)

31.         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?
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees m
WHERE w.manager_id != m.employee_id
AND w.hire_date < m.hire_date
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees w
WHERE w.manager_id = w.employee_id
AND w.hire_date < w.hire_date
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees m
WHERE w.manager_id = m.employee_id
AND w.hire_date < m.hire_date
(*)
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees m
WHERE w.manager_id = m.employee_id
AND w.hire_date > m.hire_date

32.         Which of the following database design concepts is implemented with a self join?
♦Supertype
♦Arc
♦Non-Transferability
♦Recursive Relationship (*)

33.         Which statement about a self join is true?
♦Table aliases cannot be used to qualify table names.
♦A self join must be implemented by defining a view.
♦The NATURAL JOIN clause must be used.
♦able aliases must be used to qualify table names. (*)

34.         Hierarchical queries can walk both Top-Down and Bottom-Up. True or False?
♦True (*)
♦False

35.         Which of the following database design concepts do you need in your tables to write Hierarchical queries?
♦Supertype
♦Non-Transferability
♦Recursive Relationship (*)
♦Arc

36.         EMPLOYEES Table:
Name   Null?    Type
EMPLOYEE_ID          NOT NULL     NUMBER(6)
FIRST_NAME             VARCHAR2(20)
LAST_NAME  NOT NULL     VARCHAR2(25)
DEPARTMENT_ID                 NUMBER (4)
DEPARTMENTS Table:
Name   Null?    Type
DEPARTMENT_ID     NOT NULL     NUMBER 4
DEPARTMENT_NAME          NOT NULL     VARCHAR2(30)
MANAGER_ID                       NUMBER (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?
♦SELECT d.department_id, e.first_name, e.last_name
FROM employees e, departments d
WHERE e.employee_id
RIGHT OUTER JOIN d.manager_id;
♦SELECT d.department_id, e.first_name, e.last_name
FROM employees e
LEFT OUTER JOIN departments d
WHERE (e.department_id = d.department_id);
♦SELECT d.department_id, e.first_name, e.last_name
FROM employees e
FULL OUTER JOIN departments d
ON (e.employee_id = d.manager_id);
♦SELECT d.department_id, e.first_name, e.last_name
FROM employees e
RIGHT OUTER JOIN departments d
ON (e.employee_id = d.manager_id);
(*)

37.         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?
EMPLOYEES Table:
Name   Null?    Type
EMPLOYEE_ID          NOT NULL     NUMBER (6)
FIRST_NAME             VARCHAR2 (20)
LAST_NAME  NOT NULL     VARCHAR2 (25)
EMAIL NOT NULL     VARCHAR2 (25)
PHONE_NUMBER                  VARCHAR2 (20)
HIRE_DATE   NOT NULL     DATE
JOB_ID           NOT NULL     VARCHAR2 (10)
SALARY                     NUMBER (8,2)
COMMISSION_PCT                NUMBER (2,2)
MANAGER_ID                       NUMBER (6)
DEPARTMENT_ID                 NUMBER (4)
JOBS Table:
Name   Null?    Type
JOB_ID           NOT NULL     VARCHAR2 (10)
JOB_TITLE     NOT NULL     VARCHAR2 (35)
MIN_SALARY                        NUMBER (6)
MAX_SALARY                      NUMBER (6)
♦SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary
FROM employees e
NATURAL JOIN jobs j;
♦SELECT first_name, last_name, job_id, min_salary, max_salary
FROM employees
NATURAL JOIN jobs;
(*)
♦SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary
FROM employees e
NATURAL JOIN jobs j ON (e.job_title = j.job_title);
♦SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary
FROM employees e
NATURAL JOIN jobs j
USING (job_id);
♦SELECT first_name, last_name, job_id, min_salary, max_salary
FROM employees e
FULL JOIN jobs j (job_id);

38.         Which query represents the correct syntax for a left outer join?
♦SELECT companyname, orderdate, total
FROM customers c
LEFT OUTER orders o
ON c.cust_id = o.cust_id;
♦SELECT companyname, orderdate, total
FROM customers c
LEFT JOIN orders o
ON c.cust_id = o.cust_id;
♦SELECT companyname, orderdate, total
FROM customers c
LEFT OUTER JOIN orders o
ON c.cust_id = o.cust_id;
(*)
♦SELECT companyname, orderdate, total
FROM customers c
OUTER JOIN orders o
ON c.cust_id = o.cust_id;

39.         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) ;
            ♦Inner Join
♦Optimal Join
♦Equijoin
     ♦Outer Join (*)

40.       Which of the following conditions will cause an error on a NATURAL JOIN?
♦When the NATURAL JOIN clause is based on all columns in the two tables that have the same name.
♦If it selects rows from the two tables that have equal values in all matched columns.
♦When you attempt to write it as an equijoin.
♦If the columns having the same names have different data types, then an error is returned. (*)

41.       You need to join two tables that have two columns with the same name, datatype, and precision. Which type of join would you create to join the tables on both of the columns?
♦Natural join (*)
♦Self-join
♦Cross join
♦Outer join

42.       A join between tables where the result set includes matching values from both tables but does NOT return any unmatched rows could be called which of the following? (Choose three)
♦Full outer join
♦Nonequijoin
♦Equijoin (*)
 ♦Self join (*)
♦Simple join (*)

43.       The following is a valid SQL statement.
SELECT e.employee_id, e.last_name,     d.location_id, department_id
FROM employees e JOIN departments d
USING (department_id) ;
True or False?
♦True (*)
♦False

44.       Which keyword in a SELECT statement creates an equijoin by specifying a column name common to both tables?
♦The FROM clause
♦A USING clause (*)
♦A HAVING clause
♦The SELECT clause

45.       Below find the structures of the PRODUCTS and VENDORS tables:
PRODUCTS
PRODUCT_ID NUMBER
PRODUCT_NAME VARCHAR2 (25)
VENDOR_ID NUMBER
CATEGORY_ID NUMBER
VENDORS
VENDOR_ID NUMBER
VENDOR_NAME VARCHAR2 (25)
ADDRESS VARCHAR2 (30)
CITY VARCHAR2 (25)
REGION VARCHAR2 (10)
POSTAL_CODE VARCHAR2 (11)
You want to create a query that will return an alphabetical list of products, including the product name and associated vendor name, for all products that have a vendor assigned.
Which two queries could you use?
♦SELECT p.product_name, v.vendor_name
FROM products p
JOIN vendors v
ON (vendor_id)
ORDER BY p.product_name;
♦SELECT p.product_name, v.vendor_name
FROM products p
NATURAL JOIN vendors v
ORDER BY p.product_name;
(*)
♦SELECT p.product_name, v.vendor_name
FROM products p
JOIN vendors v
USING (p.vendor_id)
ORDER BY p.product_name;
♦SELECT p.product_name, v.vendor_name
FROM products p
JOIN vendors v
USING (vendor_id)
ORDER BY p.product_name;
(*)
♦SELECT p.product_name, v.vendor_name
FROM products p
LEFT OUTER JOIN vendors v
ON p.vendor_id = v.vendor_id
ORDER BY p.product_name;

46.         A join between tables where the result set includes matching values from both tables but does NOT return any unmatched rows could be called which of the following?
♦Equijoin (*)
♦Full outer join
♦Self join (*)
♦Nonequijoin
♦Simple join (*)

47.         You need to join all the rows in the EMPLOYEES table to all the rows in the EMP_REFERENCE table. Which type of join should you create?
♦An inner join
♦A full outer join
♦A cross join (*)
♦An equijoin

48.         Which of the following conditions will cause an error on a NATURAL JOIN?
♦When the NATURAL JOIN clause is based on all columns in the two tables that have the same name.
♦If it selects rows from the two tables that have equal values in all matched columns.
♦When you attempt to write it as an equijoin.
♦If the columns having the same names have different data types, then an error is returned. (*)

49.         The primary advantages of using JOIN ON is: (Select two)
♦It permits columns that don?t have matching data types to be joined. (*)
♦The join happens automatically based on matching column names and data types.
♦It permits columns with different names to be joined. (*)
♦It will display rows that do not meet the join condition.

50.         For which condition would you use an equijoin query with the USING keyword?
♦You need to perform a join of the CUSTOMER and ORDER tables but limit the number of columns in the join condition. (*)
♦The CUSTOMER and ORDER tables have a corresponding column, CUST_ID. The CUST_ID column in the ORDER table contains null values that need to be displayed.
♦The ORDER table contains a column that has a referential constraint to a column in the PRODUCT table.
♦The CUSTOMER and ORDER tables have no columns with identical names.

51.         The keywords JOIN _____________ should be used to join tables with the same column names but different datatypes.
♦USING (*)
♦WHEN
♦ON
♦NATURAL ON

52.         Which statement about a self join is true?
♦The NATURAL JOIN clause must be used.
♦Table aliases cannot be used to qualify table names.
♦Table aliases must be used to qualify table names. (*)
♦A self join must be implemented by defining a view.

53.         Which of the following database design concepts do you need in your tables to write Hierarchical queries?
♦Recursive Relationship (*)
♦Supertype
♦Non-Transferability
♦Arc

54.         Hierarchical queries can walk both Top-Down and Bottom-Up. True or False?
♦True (*)
♦False

55.       Hierarchical queries MUST use the LEVEL pseudo column. True or False?
♦True
♦False (*)

56.       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?
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees m
WHERE w.manager_id != m.employee_id
AND w.hire_date < m.hire_date
 ♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees w
WHERE w.manager_id = w.employee_id
AND w.hire_date < w.hire_date
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees m
WHERE w.manager_id = m.employee_id
AND w.hire_date > m.hire_date
♦SELECT w.last_name, w.hire_date, m.last_name, m.hire_date
FROM employees w , employees m
WHERE w.manager_id = m.employee_id
AND w.hire_date < m.hire_date
(*)

57.       Which type of join returns rows from one table that have NO direct match in the other table?
♦Natural join
♦Outer join (*)
♦Equijoin
♦Self join

58.       What types of joins will return the unmatched values from both tables in the join?
♦Full outer joins (*)
♦Left outer joins
♦Natural joins
♦Right outer joins

59.       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?
EMPLOYEES Table:
Name   Null?    Type
EMPLOYEE_ID          NOT NULL     NUMBER (6)
FIRST_NAME             VARCHAR2 (20)
LAST_NAME  NOT NULL     VARCHAR2 (25)
EMAIL NOT NULL     VARCHAR2 (25)
PHONE_NUMBER                  VARCHAR2 (20)
HIRE_DATE   NOT NULL     DATE
JOB_ID           NOT NULL     VARCHAR2 (10)
SALARY                     NUMBER (8,2)
COMMISSION_PCT                NUMBER (2,2)
MANAGER_ID                       NUMBER (6)
DEPARTMENT_ID                 NUMBER (4)
JOBS Table:
Name   Null?    Type
JOB_ID           NOT NULL     VARCHAR2 (10)
JOB_TITLE     NOT NULL     VARCHAR2 (35)
MIN_SALARY                        NUMBER (6)
MAX_SALARY                      NUMBER (6)
♦SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary
FROM employees e
NATURAL JOIN jobs j
USING (job_id);
♦SELECT first_name, last_name, job_id, min_salary, max_salary
FROM employees
NATURAL JOIN jobs;
(*)
♦SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary
FROM employees e
NATURAL JOIN jobs j ON (e.job_title = j.job_title);
♦SELECT e.first_name, e.last_name, e.job_id, j.min_salary, j.max_salary
FROM employees e
NATURAL JOIN jobs j;
♦SELECT first_name, last_name, job_id, min_salary, max_salary
FROM employees e
FULL JOIN jobs j (job_id);

60.       What is another name for a simple join or an inner join?
♦Equijoin (*)
♦Self Join
♦Nonequijoin
♦Outer Join

Leave a comment