TOPICMIDTERM
TOPICMIDTERM
Sql intersect - It is used to combine two select statements, but returns rows only from the first select
statement that are identical to the row in the second select statement
Join - Means for combining fields from two tables by using values common to each
Inner join - It creates a new result table by combining column values of two tables based upon the join
predicate
Sql except - It is used to combine two select statements, but returns rows only from the first select
statement that are not returned by the second select statement
Sql union clause - It combine the result of two or more select statement without returning any duplicate
rows
Union all -It combine the result of two or more select statement and also returning any duplicate rows
Right join - It returns all rows from the right table , even if there are no matches in the left table
TRUE- The except clause returns only rows, which are not in the second select statement
FALSE - To use the union clause each select statement must have different data type
FASLE- To use the union clause each select statement must have different number of columns selected
FALSE- The most important and frequently used of the joins is the full joins
TRUE- The joined table will contain all the records from both the tables and fill in nulls for missing
matches on the either side
The SQL UNION clause/operator is used to combine the results of two or more SELECT
statements without returning any duplicate rows.
To use this UNION clause, each SELECT statement must have
UNION removes all duplicates, if any form the data and only displays distinct values
If duplicates values are required in the resultant data, then UNION ALL is used
Syntax
UNION
Syntax
INTERSECT
The SQL EXCEPT clause/operator is used to combine two SELECT statements and returns rows
from the first SELECT statement that are not returned by the second SELECT statement. This
means EXCEPT returns only rows, which are not available in the second SELECT statement.
Just as with the UNION operator, the same rules apply when using the EXCEPT operator.
MySQL does not support the EXCEPT operator.
Syntax
EXCEPT
A SQL JOINs clause is used to combine records from two or more tables in a database. A JOIN is
a means for combining fields from two tables by using values common to each
SAMPLE SYNTAX
SQL> SELECT ID, NAME, AGE, AMOUNT
FROM CUSTOMERS, ORDERS
WHERE CUSTOMERS.ID = ORDERS.CUSTOMER_ID;
The most important and frequently used of the joins is the INNER JOIN. They are also referred
to as an EQUIJOIN.
The INNER JOIN creates a new result table by combining column values of two tables (table1
and table2) based upon the join-predicate. The query compares each row of table1 with each
row of table2 to find all pairs of rows which satisfy the join-predicate. When the join-predicate
is satisfied, column values for each matched pair of rows of A and B are combined into a result
row.
Syntax
Syntax
The SQL RIGHT JOIN returns all rows from the right table , even if there are no matches in the
left table. This means that if the ON clause matches 0 (zero) records in the left table; the join
will still return a row in the result, but with NULL in each column from the left table.
This means that a right join returns all the values from the right table, plus matched values
from the left table or NULL in case of no matching join predicate.
Syntax
The SQL FULL JOIN combines the results of both left and right outer joins.
The joined table will contain all records from both the tables and fill in NULLs for missing
matches on either side.
Syntax