04 - ASQL - Quiz1 - SQL Advance 1: Tests & Quizzes
04 - ASQL - Quiz1 - SQL Advance 1: Tests & Quizzes
04_ASQL_Quiz1_SQL Advance 1
Show Feedback | Table of Contents
Part 1 of 1 -
Question 1 of 20
With the UNION clause, each query involved must output the same number of columns, and they 5.0 Points
must be UNION compatible.
True
False
Reset Selection
Question 2 of 20
You are a developer for a Microsoft SQL Server database instance used to support a customer 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]);
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.
https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 1/8
5/13/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes
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;
"
Reset Selection
Question 3 of 20
Sub-queries can be nested in? 5.0 Points
Reset Selection
Question 4 of 20
What type of join is needed when you wish to return rows when there is at least one match in both 5.0 Points
tables?
A. Cross-join
B. Inner join
C. Outer join
Reset Selection
https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 2/8
5/13/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes
Question 5 of 20
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
A. 3
B. 2
C. 4
D. 5
Reset Selection
Question 6 of 20
What type of join is needed when you wish to include rows when there is a match between the 5.0 Points
tables?
A. Cross-join
B. Inner join
C. Outer join
Reset Selection
Question 7 of 20
There should be one condition within the WHERE clause for each pair of tables being joined. 5.0 Points
True
False
Reset Selection
https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 3/8
5/13/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes
Question 8 of 20
The joining technique is useful when data from several relations are to be retrieved and displayed 5.0 Points
and the relationships are not necessarily nested
True
False
Reset Selection
Question 9 of 20
We refer to a join as a self-join when? 5.0 Points
Reset Selection
Question 10 of 20
5.0 Points
Which of the following SQL statements can extract the average salary by department from tables A
and B?
https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 4/8
5/13/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes
Reset Selection
Question 11 of 20
A UNION query is which of the following? 5.0 Points
A. Combines the output from multiple queries and does not include the same number of columns
B. Combines the output from multiple queries and must include the same number of columns.
C.
Combines the output from no more than two queries and does not include the same number of columns
D. Combines the output from no more than two queries and must include the same number of columns.
Reset Selection
Question 12 of 20
The following SQL is which type of join: 5.0 Points
SELECT CUSTOMER_T.CUSTOMER_ID, ORDER_T.CUSTOMER_ID, NAME, ORDER_ID
FROM CUSTOMER_T, ORDER_T ;
A. Inner Join
B. Self Join
C. Outer Join
D. Cross Join
Reset Selection
Question 13 of 20
Which of the following is one of the basic approaches for joining tables? 5.0 Points
A. Subqueries
B. Union Join
C. Inner/Outer join
Reset Selection
Question 14 of 20
5.0 Points
https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 5/8
5/13/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes
You have a database that contains two tables named ProductCategory and ProductSubCategory. You need to
write a query that returns a list of product categories that contain more than ten sub-categories. Which query
should you use?
A. SELECT [Name]
FROM ProductSubCategory
WHERE ProductCategoryID IN (SELECT ProductCategoryID
FROM ProductCategory)
GROUP BY [Name]
HAVING COUNT(*) > 10
B. SELECT [Name]
FROM ProductSubCategory
WHERE ProductCategoryID NOT IN (SELECT ProductCategoryID
FROM ProductCategory)
GROUP BY [Name]
HAVING COUNT(*) > 10
C. SELECT [Name]
FROM ProductCategory c
WHERE EXISTS (SELECT ProductCategoryID
FROM ProductSubCategory
WHERE ProductCategoryID = c.ProductCategoryID
GROUP BY ProductCategoryID
HAVING COUNT(*) > 10)
Reset Selection
Question 15 of 20
The IN SQL keyword? 5.0 Points
Reset Selection
Question 16 of 20
How many tables may be included with a join? 5.0 Points
A. One
B. Two
https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 6/8
5/13/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes
C. Three
Reset Selection
Question 17 of 20
In SQL language, one data manipulation command that combines the records from two tables is 5.0 Points
called
A. PRODUCT
B. SELECT
C. JOIN
D. PROJECT
Reset Selection
Question 18 of 20
A correlated sub-query is where the outer query depends on data from the inner query. 5.0 Points
True
False
Reset Selection
Question 19 of 20
The UNION clause is used to combine the output from multiple queries together into a single result 5.0 Points
table
True
False
Reset Selection
Question 20 of 20
The following SQL is which type of join: 5.0 Points
SELECT CUSTOMER_T.CUSTOMER_ID, ORDER_T.CUSTOMER_ID, NAME, ORDER_ID
FROM CUSTOMER_T, ORDER_T
WHERE CUSTOMER_T.CUSTOMER_ID = ORDER_T.CUSTOMER_ID
A. Inner Join
B. Self Join
C. Outer Join
D. Cross Join
https://gst.fsoft.com.vn/portal/site/b0d8cac9-9f19-4f09-9eb7-71661cf003c0/tool/e2c4d983-f0d7-4b16-b69b-7235434d4adb/jsf/delivery/beginTakingAss… 7/8
5/13/2021 campuslink.admin : HCM21_CPL_JAVA_05 : Tests & Quizzes
Reset Selection
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/delivery/beginTakingAss… 8/8