Which TransactSQL statement should you use?
You have a table named Sales. You are tasked to list products that have been sold to less than ten
customers.
You need to write a query to achieve the task.
Which TransactSQL
statement should you use?
Which query should you use?
You have two tables named Customers and Orders.
for customers that have placed at least one order, you need to produce a list of customer names and
the
number of orders for each customer.
Which query should you use?
Which TransactSQL statement should you use?
You have a table named Products. The table contains a column named Color.
You need to write a TransactSQL
statement that calculates the percentage of products of each product
color.
Which TransactSQL
statement should you use?
Which code segment should you use?
You have two tables named SalesPerson and SalesTerritory.
You need to create sample data by using a Cartesian product that contains the data from the
SalesPerson
and SalesTerritory tables.
Which code segment should you use?
Which join clause should you use to complete the query?
You have a table named Employees.
You want to identify the supervisor to which each 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?
What results should the query produce?
You have a table named Subcategories that contains subcategories for socks, vests and helmets. You
have another table named Products that contains products only from the subcategories socks and
vests.
You have the following query:
SELECT s.Name, p.Name AS ProductName
FROM Subcategories s
OUTER APPLY
(SELECT *
FROM Products pr
WHERE pr.SubcategoryID = s.SubcategoryID) p
WHERE s.Name IS NOT NULL;
You need to predict the results of the query.
What results should the query produce?
Which list of products should the query return?
You have two tables named dbo.CurrentProducts and dbo.ArchiveProducts. You have the following
query:
SELECT ProductID, Name
FROM dbo.CurrentProducts
UNION ALL
SELECT ProductID, Name
FROM dbo.ArchiveProducts;
You need to predict the list of products that the query will produce.
Which list of products should the query return?
Which TransactSQL operator should you insert in line 03?
You have two tables named Products and NewProducts that have identical structures. You have the
following query (Line numbers are included for reference only):
01 SELECT Product, Description
02 FROM dbo.Products
03
04 SELECT Product, Description
05 FROM dbo.NewProducts
You need to choose the appropriate TransactSQL
operator to display rows that exist in both tables.
Which TransactSQL
operator should you insert in line 03?
Which system function should you use?
You are tasked to create a table that has a column that must store the current time accurate to ten
microseconds.
You need to use a system function in conjunction with the DEFAULT option in the column definition.
Which system function should you use?
Which code segment should you use?
You need to round the value 1.75 to the nearest whole number.
Which code segment should you use?