[solved] – Question 76504

Assume there are two tables, A and B, with a one to many relationship. What join type would you use to get records from A and only those from B that match.

INNER JOIN

FULL JOIN

LEFT JOIN

OUTER JOIN

Expert Answer


[solved] – Question 76505

Table Customer_T has customer info including the CustomerID and CustomerName, while table Payment_T has every payment made by each CustomerID.

What statement would provide all records of payments made showing customer name?

SELECT PAYMENT.*, CUSTOMERNAME FROM PAYMENT_T

SELECT PAYMENT.*, CUSTOMERNAME FROM PAYMENT_T JOIN CUSTOMER_T ON PAYMENTID = CUSTOMERID

SELECT PAYMENT.*, CUSTOMERNAME FROM PAYMENT_T JOIN CUSTOMER_T ON CUSTOMERID = CUSTOMERID

SELECT PAYMENT.*, CUSTOMERNAME FROM PAYMENT_T P JOIN CUSTOMER_T C ON P.CUSTOMERID = C.CUSTOMERID

Expert Answer


[solved] – Question 76506

In the query below, what is the statement in between parenthesis?

SELECT CUSTOMERNAME
FROM CUSTOMER_T
WHERE CUSTOMERID IN
(SELECT DISTINCT CUSTOMERID FROM ORDER_T)

a list

A correlated subquery

A non-correlated subquery

A correlated insert statement

Expert Answer


[solved] – Question 76507

What is S an alias of in the query below?
select orderid, salespersonname
from
(select salespersonid, salespersonname, SalespersonTelephone
from Salesperson_T where SalesTerritoryID = 1) S
join Order_T O
on O.SalespersonID = S.SalespersonID

An Outer Join

A Derived Table

A Union

A Join

Expert Answer


[solved] – Question 76508

What would the following query include?

SELECT Customer_T.CustomerID,CustomerName, OrderID

FROM Customer_T RIGHT OUTER JOIN Order_T

ON Customer_T.CustomerID = Order_T.CustomerID

only rows that match both Customer_T and Order_T Tables

only rows that do not match both Customer_T and Order_T Tables

all rows of the Order_T Table regardless of matches with the Customer_T Table

all rows of the Customer_T Table regardless of matches with the Order_T Table

Expert Answer


[solved] – Question 76509

The COMMIT statement is …

Only works when combined with a ROLLBACK.

Only works within a transaction.

not needed because the server always commits changes.

Makes changes outside a transaction permanen.t

Expert Answer


[solved] – Question 76510

What would happen if a ROLLBACK is executed after an INSERT statement within a transaction?

The ROLLBACK fails because it is only for UPDATE

Records from the table are deleted

The record(s) that were inserted do not get committed to the table

The records are left inconsistent

Expert Answer


[solved] – Question 76511

The query below is an example of a:
SELECT O.ORDERID, o.SALESPERSONID, S.SALESPERSONID
FROM ORDER_T o FULL JOIN SALESPERSON_t s
ON O.SALESPERSONID = S.SalespersonID

An INNER JOIN

A Subquery

A UNION

A FULL JOIN

Expert Answer


[solved] – Question 7652

int display(char ch, int n);

that displays the character ch on the stdout device (screen) consecutively n times if n>0 and displays nothings if n≤0. When n>0 and ch is not the blank character, the function will also display an additional newline at the end. The function display returns the actual number of characters (excluding the possible newline at the end) displayed.

Write a driver program, making use of the above specified function display, that line by line repeatedly display the character pattern

*
**
***
****
*****
******
*******
********
*********
**********
++++++++++
+++++++++
++++++++
+++++++
++++++
+++++
++++
+++
++
+

until a given numer of non-whitespace characters are displayed. In other words, the program will first ask the user to enter the total number, say target, of non-whitespace characters to be displayed, and then it will repeatedly display the above pattern until exactly target non-whitespac

Expert Answer


[solved] – Question 76523

Write a function num_uniques that takes in a string and returns the number of unique characters in the string.

Hint: You can use a std::map to maintain a count of the characters.

#include <string>

using namespace std;

int num_uniques(string str) {

//code..

}

Expert Answer