1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54 55
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35 36
37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54 55
Java Hyd Team
SQL INTERVIEW QUESTIONS.pdf
Possibly this can help you with sql
Java Hyd Team
JAVA BASICβΎNOTES.pdf
Check this for hand written notes of html
The different join types in Oracle SQL are:
β Inner join: Returns records that exist in both tables.
β Left join/left outer join: Returns records that exist in the first table and shows NULL for those
values that donβt exist in the second table.
β Right join/right outer join: Returns records that exist in the second table and shows NULL for
those values that donβt exist in the first table.
β Full join/full outer join: Returns records that exist in both the first and second table, and shows
NULL for those values that donβt exist in the corresponding table.
β Cross join: Returns all combinations of all records in both tables.
β Natural join: an inner join with two tables on columns that have the same names
β Self join: A join from one table to another record in the same table.
β Inner join: Returns records that exist in both tables.
β Left join/left outer join: Returns records that exist in the first table and shows NULL for those
values that donβt exist in the second table.
β Right join/right outer join: Returns records that exist in the second table and shows NULL for
those values that donβt exist in the first table.
β Full join/full outer join: Returns records that exist in both the first and second table, and shows
NULL for those values that donβt exist in the corresponding table.
β Cross join: Returns all combinations of all records in both tables.
β Natural join: an inner join with two tables on columns that have the same names
β Self join: A join from one table to another record in the same table.
π1
The WHERE clause is run to remove data before grouping. The HAVING clause is run on data after it
has been grouped.
This also means the WHERE clause cannot operate on aggregate functions calculated as part of the
group.
has been grouped.
This also means the WHERE clause cannot operate on aggregate functions calculated as part of the
group.
COUNT(column) will return the number of non-NULL values in that column. COUNT(DISTINCT
column) will return the number of unique non-NULL values in that column.
column) will return the number of unique non-NULL values in that column.
. Whatβs wrong with this query?
SELECT department_id, count(*)FROM department;
Answer:
There is no GROUP BY clause and it will display an error. Because we have used the COUNT function,
which is an aggregate function, along with a database field, we need to add a GROUP BY clause. It
should GROUP BY the department_id column.
SELECT department_id, count(*)FROM department;
Answer:
There is no GROUP BY clause and it will display an error. Because we have used the COUNT function,
which is an aggregate function, along with a database field, we need to add a GROUP BY clause. It
should GROUP BY the department_id column.
Whatβs wrong with this query?
SELECT department_id, count(*)
FROM department
WHERE count(*) > 5
GROUP BY department_id;
Answer:
The WHERE clause cannot include any checks on the aggregate column β even if a GROUP BY has
been performed.
This is because the WHERE happens before the grouping, so there is no way for the WHERE clause to
know what the value of the COUNT function is.
To resolve this, use the HAVING clause to check for COUNT(*) > 5.
SELECT department_id, count(*)
FROM department
WHERE count(*) > 5
GROUP BY department_id;
Answer:
The WHERE clause cannot include any checks on the aggregate column β even if a GROUP BY has
been performed.
This is because the WHERE happens before the grouping, so there is no way for the WHERE clause to
know what the value of the COUNT function is.
To resolve this, use the HAVING clause to check for COUNT(*) > 5.