Académique Documents
Professionnel Documents
Culture Documents
b. Explain the difference between COUNT, COUNT DISTINCT, and COUNT(*) in SQL. When will these
three commands generate the same and different results?
Does not consider null values Does not consider null value It consider Null values
It considers only those tuples It also considers only those It considers all rows irrespective
which have a value tuples, which have value. of any rows contains values or
Additionally , it only considers not
once if more than one tuple has
same value
It returns total count of tuples by It returns total number of distinct Count(*) returns total number of
satisfying where condition tuples which satisfy where tuples satisfying the condition
condition. One than one tuple given using where statement
having same value can be
considered only once
1.c. Can an outer join be easily implemented when joining more than two tables?
Why or why not? How does Oracle address this issue?
Ans: Outer join is of 3 types
Left Outer Join
Right Outer Join
Full outer Join
In all outer join, joining more than three tables is not possible in one join statement but can be done in
multiple join statements. The OUTER JOIN syntax does not apply easily to a join condition of more than
two tables.
For example:
In above Left outer join Query the all records from table B will be joined with matching records of table C
and result set will again get joined with all record from table A. The result set will have all records from
table A matching with result set of join between B and C.
Similar case is with Right outer join and full outer join in Oracle.
AS
IF EXISTS (
FROM Room
)
BEGIN
RAISERROR (' Double room must be greater than 100', 16, 1);
ROLLBACK TRANSACTION;
RETURN
END;