In: Computer Science
Subject - DataBase / MySQL
* Which of the following is not correct about the statement provided?
SELECT Customer#, FirstName, LastName
FROM Customers C JOIN Orders O ON C.Customer# = O.Customer#
JOIN OrderItems OI ON O.Order# = OI.Order#
JOIN Books B ON OI.ISBN = B.ISBN
WHERE Category = 'Fitness' AND Category = 'Computers';
Select one:
a. Joins the OrderItems table to the
Books table using the field ISBN
b. All of these are correct
c. Joins the Customer table to the Books
table using Customer#
d. Joins the Customer table to the Orders
table using the field Customer#
e. Joins the Orders table to the
OrderItems table using the field Order#
* Which statement is NOT true about joining tables using an inner join?
Select one:
a. Only records that exist in both tables
will be returned
b. The field names used to join must to
be identical
c. The values in the fields used to join
must be identical
* Which join type returns all possible combination of records, so that if a table that has 5 records is joined to a table with 3 records, 15 records are listed?
Select one:
a. Full join
b. Outer join
c. Inner join
d. Cross Join
e. Self-join
-THANK YOU
Answers:
Which of the following is not correct about the
statement provided?
Answer: C. Joins the Customer table to the Books
table using Customer#
There is no join between Customer and Booka table using Customer#.
rest 3 statements about join is correct.
Which statement is NOT true about joining tables using
an inner join?
Answer: B. The field names used to join
must to be identical
It is possible to join two tables with different column names but
values must be identicle.
Example:
SELECT *
FROM dbo.Table1 t1
INNER JOIN dbo.Table2 t2 ON t1.OID = t2.TaskID;
-- The INNER JOIN will take rows from dbo.Table1 where the OID column values match
values contained in the TaskID column from the Table2 table.
Which join type returns all possible combination of
records, so that if a table that has 5 records is joined to a table
with 3 records, 15 records are listed?
Answer: D. Cross Join
Cross Join gets a row from the first table and then creates a new
row for every row in the second table. Then It does same for the
next row for in the first table and so on. So at the end we get
(Number of rows in table one) * (Number of rows in table
two).