Section 6 Quiz Oracle Database Programming with SQL-Answers

Section 6 Quiz Tüm Soruların Cevapları
1. Which of the following conditions will cause an error on a NATURAL JOIN?


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

If the columns having the same names have different data types. (*)

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

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


2. A NATURAL JOIN is based on:

Columns with the same name

Columns with the same datatype and width

Tables with the same structure

Columns with the same name and datatype (*)


3. 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?

Outer join

Self-join

Cross join

Natural join (*)


4. Which keyword in a SELECT statement creates an equijoin by specifying a column name common to both tables?

The FROM clause

A HAVING clause

A USING clause (*)

The SELECT clause

5. You can do nonequi-joins with ANSI-Syntax. True or False?
Doğru (*)

Yanlış


6. Evaluate this SELECT statement:
SELECT a.lname || ', ' || a.fname as "Patient", b.lname || ', ' || b.fname as "Physician", c.admission
FROM patient a
JOIN physician b
ON (b.physician_id = c.physician_id)
JOIN admission c
ON (a.patient_id = c.patient_id);

Which clause generates an error?

ON (a.patient_id = c.patient_id)

ON (b.physician_id = c.physician_id); (*)

JOIN admission c

JOIN physician b


7. 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


8. Hierarchical queries MUST use the LEVEL pseudo column. True or False?

Doğru
Yanlış (*)


9. 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 cross join

a self join (*)

a left outer join

a full outer join


10. Which statement about a self join is true?

The NATURAL JOIN clause must be used.

Table aliases must be used to qualify table names. (*)

A self join must be implemented by defining a view.

Table aliases cannot be used to qualify table names.

11. Which of the following database design concepts is implemented with a self join?
Arc

Non-Transferability

Recursive Relationship (*)

Supertype

12. Which type of join returns rows from one table that have NO direct match in the other table?
Equijoin

Natural join

Outer join (*)

Self join


13. Which syntax would be used to retrieve all rows in both the EMPLOYEES and DEPARTMENTS tables, even when there is no match?

FULL OUTER JOIN (*)

LEFT OUTER JOIN AND RIGHT OUTER JOIN

Use any equijoin syntax

FULL INNER JOIN


14. 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?

        A cross join

A right outer join (*)

A left outer join

An inner join

15. 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) ;

Optimal Join

Outer Join (*)

Inner Join

Equijoin

Yorumlar