CIS336 Quiz Week 5

$5.00

CIS336 Quiz Week 5
(TCO 7) If Table A, which contains five rows is joined to Table B, which has eight rows…

SKU: CIS336 Quiz Week 5 Categories: , Tags: , , , ,

Description

CIS336 Quiz Week 5

CIS336 Quiz Week 5

A+

(TCO 7) The _____ condition is generally composed of an equality comparison between the primary key and foreign key of related tables.

Select

View

Join

From

(TCO 7) If Table A, which contains five rows is joined to Table B, which has eight rows without a valid join condition, the resulting cartesian product would have _____ rows.

Five

Eight

13

40

(TCO 7) Given the two tables described below, which of the following JOIN queries (if any) is not correct?
customer:   customerid(PK), lastname, firstname
order:  orderid(PK), orderdate, customerid(FK)

SELECT lastname, orderdate from customer JOIN order ON customer.customerid = order.customerid;

SELECT lastname, orderdate from customer JOIN order USING (customerid);

SELECT lastname, orderdate from customer, order WHERE customer.customerid = order.customerid;

All of the above

(TCO 7) In a join, column names need to be qualified only

In inner joins

In outer joins

When the code is confusing

When the same column names exist in both tables

(TCO 7) A left join returns

Rows in the left table that don’t satisfy the join condition

Unmatched rows from both the left and right tables

Rows in the right table that don’t satisfy the join condition

The Cartesian product of the two tables

(TCO 7) Which statement is NOT true about the USING keyword?

You use it to simplify the syntax for joining tables

The ON clause must also be used along with the USING clause

It can be used with inner or outer joins

The join will use the equals operator to compare the two columns

(TCO 7) Consider the ERD below. How many tables would be required to create a query to display the customer first and last name along with orderdate of each order they placed?

One

Two

Three

Four

(TCO 7) Consider the ERD below. Which query will return the first and last name of each customer whose order was placed after January 1, 2014?

SELECT firstname, lastname from customer, order WHERE orderdate > ‘2014-01-01’;

SELECT firstname, lastname from customer JOIN  order WHERE orderdate > ‘2014-01-01’;

SELECT firstname, lastname from customer JOIN order USING (customerID) WHERE orderdate > ‘2014-01-01’;

SELECT firstname, lastname from customer WHERE orderdate > ‘2014-01-01’

(TCO 7) Consider the ERD below. What query will return the orderid and date of any orders with products having a price more than $50?

SELECT orderID, orderdate from order JOIN OrderLine JOIN Product WHERE price > 50;

SELECT orderID, orderdate from order, OrderLine, Product WHERE price > 50;

SELECT orderID, orderdate from order JOIN OrderLine ON order.orderID = OrderLine.orderID JOIN Product ON OrderLine.productID = Product.productID WHERE price > 50;

SELECT orderID, orderdate from order JOIN OrderLine ON order.orderID = OrderLine.orderID WHERE price > 50;

(TCO 7) Consider the ERD below. Note that there are some products produced in-house that do not require a vendor, thus their vendorID is NULL. Also note that not all vendors currently supply products.  Which query would be used to generate a report showing vendorname and productname, and will include ALL products even if they do not currently have a vendor?

SELECT vendorname, productname FROM vendor LEFT JOIN product;

SELECT vendorname, productname FROM vendor RIGHT JOIN product;

SELECT vendorname, productname FROM vendor LEFT JOIN product ON vendor.vendorID = product.vendorID;

SELECT vendorname, productname FROM vendor RIGHT JOIN product ON vendor.vendorID = product.vendorID;