You are on page 1of 9

13/05/2021 campuslink.

admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

HCM21_CPL_JAVA_05    Tests & Quizzes

Tests & Quizzes

04_ASQL_Quiz1_SQL Advance 1
Return to Assessment List

Part 1 of 1 - 90.0/ 100.0 Points

Question 1 of 20
You have a table named Employees. You want to identify the supervisor to which each 5.0/ 5.0 Points
employee reports. You write the following query.

SELECT e.EmloyeeName AS [EmployeeName], s.EmployeeName AS [SuperVisorName] FROM Employees


e

You need to ensure that the query returns a list of all employees and their respective supervisor. Which join
clause should you use to complete the query?

A. INNER JOIN Employees s ON e.EmployeeId = s.EmployeeId

B. RIGHT JOIN Employees s ON e.ReportsTo = s.EmployeeId

C. LEFT JOIN Employees s ON e.ReportsTo = s.EmployeeId

Question 2 of 20
5.0/ 5.0 Points
How many rows are included in the table gained as as result of execution of the following
statement?
SELECT DISTINCT customer_name, merchandise_name, unit_price
FROM order_table, merchandise_table
WHERE order_table.merchandise_number = merchandise_table.mnrchandise_number

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/index/mainIndex 1/9
13/05/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

A. 3

B. 5

C. 4

D. 2

Question 3 of 20
Which of the following is one of the basic approaches for joining tables? 5.0/ 5.0 Points

A. Subqueries

B. Union Join

C. Inner/Outer join

D. All of the above

Question 4 of 20
With the UNION clause, each query involved must output the same number of columns, and 5.0/ 5.0 Points
they must be UNION compatible.

True
False

Question 5 of 20
What type of join is needed when you wish to return rows when there is at least one match in 5.0/ 5.0 Points
both tables?

A. Cross-join

B. Inner join

C. Outer join

D. All of the above.

Question 6 of 20
You have a Microsoft SQL Server 2012 database that contains tables named Customers and 5.0/ 5.0 Points
Orders. The tables are related by a column named CustomerID. You need to create a query that meets the
following requirements:
Returns the CustomerName for all customers and the OrderDate for any orders that they have placed.
Results must include customers who have not placed any orders.
https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/index/mainIndex 2/9
13/05/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

Which Transact-SQL query should you use?

A. "SELECT CustomerName, CrderDate


FROM Customers
JOIN Orders
ON Customers.CustomerID = Orders.CustomerID
"

B. "SELECT CustomerName, OrderDate


FROM Customers
RIGHT OUTER JOIN Orders
ON Customers.CustomerID = Orders.CustomerID
"

C. "SELECT CustomerName, OrderDate


FROM Customers
LEFT OUTER JOIN Orders
ON Customers.CustomerID = Orders.CustomerID
"

D. "SELECT CustomerName, OrderDate


FROM Customers
CROSS JOIN Orders
ON Customers.CustomerID = Orders.CustomerID
"

Question 7 of 20
The most frequently used relational operation, which merges data from two or more related 5.0/ 5.0 Points
tables into one resultant table, is called an cross-join.

True
False

Question 8 of 20
5.0/ 5.0 Points
Which is the correct data returned from executing following SQL statements on the “Product”
and “Sales_Datails” tables?
SELECT X.Product_No
FROM Product X LEFT OUTER JOIN Sales_Details Y ON X.Product_No=Y.Product_No

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/index/mainIndex 3/9
13/05/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

A. S101, S103, S104

B. S101, S101, S102, S103, S104, S104

C. S101, S101, S103, S104, S104

D. S101, S102, S103, S104

Question 9 of 20
Which of the following is one of the basic approaches for joining tables? 5.0/ 5.0 Points

A. Subqueries

B. Union Join

C. Natural join

D. All of the mentioned options

Question 10 of 20
Which of the following statements is true concerning subqueries? 5.0/ 5.0 Points

A. Involves the use of an inner and outer query.

B. Cannot return the same result as a query that is not a subquery.

C. Does not start with the word SELECT.

D. All of the mentioned options

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/index/mainIndex 4/9
13/05/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

Question 11 of 20
Sub-queries can be nested in? 5.0/ 5.0 Points

A. DELETE statements only.

B. UPDATE, DELETE, INSERT and SELECT statements.

C. INSERT statements only.

D. UPDATE statements only.

Question 12 of 20
The LIKE SQL keyword is used along with? 5.0/ 5.0 Points

A. JOIN clause.

B. GROUP BY clause.

C. WHERE clause.

D. ORDER BY clause.

Question 13 of 20
Which of the following is a correlated subquery? 5.0/ 5.0 Points

A. Uses the result of an inner query to determine the processing of an outer query

B. Uses the result of an outer query to determine the processing of an outer query

C. Uses the result of an outer query to determine the processing of an inner query

D. Uses the result of an inner query to determine the processing of an inner query

Question 14 of 20
You are a developer for a Microsoft SQL Server database instance used to support a customer 0.0/ 5.0 Points
service application. You create tables named complaint, customer, and product as follows:

CREATE TABLE [dbo].[complaint] ([ComplaintID] [int], [ProductID] [int], [CustomerID] [int], [ComplaintDate]
[datetime]);

CREATE TABLE [dbo].[customer] ([CustomerID] [int], [CustomerName] [varchar](100), [Address] [varchar]


(200), [City] [varchar](100), [State] [varchar](50), [ZipCode] [varchar](5));

CREATE TABLE [dbo].[product] ([ProductID] [int], [ProductName] [varchar](100), [SalePrice] [money],


[ManufacturerName] [varchar](100));

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/index/mainIndex 5/9
13/05/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

You need to write a query to sum the monthly sales of each product.
Which SQL query should you use?

A. "SELECT c.CustomerName,COUNT(com.ComplaintID) AS complaints


FROM customer c
INNER JOIN complaint com ON c.CustomerID = com.CustomerID
GROUP BY c.CustomerName
HAVING COUNT(com.ComplaintID) > 10;
"

B.
"SELECT p.ProductName,DATEPART(mm, com.ComplaintDate) ComplaintMonth,SUM(p.SalePrice) AS
Sales
FROM product p
INNER JOIN complaint com ON p.ProductID = com.ProductID
GROUP BY p.ProductName, ComplaintMonth;
"

C. "SELECT c.CustomerName,p.ProductName,SUM(p.SalePrice) AS Sales


FROM product p
INNER JOIN complaint com ON p.ProductID = com.ProductID
INNER JOIN customer c ON com.CustomerID = c.CustomerID
GROUP BY GROUPING SETS ((c.CustomerName, p.ProductName), ());
"

Question 15 of 20
What type of join is needed when you wish to return rows when there is at least one match in 5.0/ 5.0 Points
both tables?

A. Cross-join

B. Inner join

C. Outer join

D. All of the above

Question 16 of 20
The INNER JOIN clause? 0.0/ 5.0 Points

A. Returns all rows that have matching value in the field on which the 2 tables are joined.

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/index/mainIndex 6/9
13/05/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

B.
Returns only the rows from the first table, which have non-matching values with the second table in the
field on which the 2 tables are joined.

C. Returns all the matching rows from 2 tables.

D. Returns all rows from 2 tables.

Question 17 of 20
5.0/ 5.0 Points
Which of the following product groups can be found when searching the “Product Inventory”
table for products with a sales price of 500 dollars or more per unit and an inventory of less than 10 units?

A. Medium refrigerator, small refrigerator, and air conditioner

B. Large refrigerator, medium refrigerator, small refrigerator, air purifier, and air conditioner

C.
Large refrigerator, medium refrigerator, small refrigerator, portable refrigerator, air purifier, coffee maker,
and air conditioner

D. Medium refrigerator, small refrigerator, portable refrigerator, coffee maker, and air conditioner

Question 18 of 20
5.0/ 5.0 Points

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/index/mainIndex 7/9
13/05/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

What type of join is needed when you wish to include rows when there is a match between the tables?

A. Cross-join

B. Inner join

C. Outer join

D. All of the above

Question 19 of 20
You are a developer for a Microsoft SQL Server database instance used to support a customer 5.0/ 5.0 Points
service application. You create tables named complaint, customer, and product as follows:

CREATE TABLE [dbo].[complaint] ([ComplaintID] [int], [ProductID] [int], [CustomerID] [int], [ComplaintDate]
[datetime]);

CREATE TABLE [dbo].[customer] ([CustomerID] [int], [CustomerName] [varchar](100), [Address] [varchar]


(200), [City] [varchar](100), [State] [varchar](50), [ZipCode] [varchar](5));

CREATE TABLE [dbo].[product] ([ProductID] [int], [ProductName] [varchar](100), [SalePrice] [money],


[ManufacturerName] [varchar](100));

You need to write a query to identify all customers who have complained about products that have an average
sales price of 500 or more from September 01, 2011.

Which SQL query should you use?

A. "SELECT c.CustomerName,COUNT(com.ComplaintID) AS Complaints


FROM customer c
INNER JOIN complaint com ON c.CustomerID = com.CustomerID
WHERE COUNT(com.ComplaintID) > 10
GROUP BY c.CustomerName;
"

B.
"SELECT p.ProductName,DATEPART(mm, com.ComplaintDate) ComplaintMonth,SUM(p.SalePrice) AS
Sales
FROM product p
INNER JOIN complaint com ON p.ProductID = com.ProductID
GROUP BY CUBE;.CustomerName,COUNT(com.ComplaintID) AS complaints
FROM customer c INNER JOIN complaint com ON c.CustomerID = com.CustomerID
GROUP BY c.CustomerName
HAVING COUNT(com.ComplaintID) > 10;
"

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/index/mainIndex 8/9
13/05/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes

C. "SELECT c.CustomerName, AVG(p.SalePrice) AS Sales


FROM product p
INNER JOIN complaint com ON p.ProductID = com.ProductID
INNER JOIN customer c ON com.CustomerID = c.CustomerID
WHERE com.ComplaintDate > '09/01/2011'
GROUP BY c.CustomerName
HAVING AVG(p.SalePrice) >= 500
"

Question 20 of 20
You have two tables named Customer and SalesOrder. In the Customer table you have 1000 5.0/ 5.0 Points
customers, of which 900 customers have orders in the SalesOrder table. You execute the following query to
list all customers that have had at least one sale.

SELECT * FROM Customer WHERE Customer.CustomerID IN (SELECT SalesOrder.CustomerID FROM


SalesOrder).

You need to identify the results of the query. Which results will the query return?

A. The 900 rows in the Customer table with matching rows in the SalesOrder table

B. The 1000 rows in the Customer table

C. No rows

Gateway
Accessibility Information
The Sakai Project

Powered by Sakai
Copyright 2017 FPT-Software

https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/index/mainIndex 9/9

You might also like