Which query should you use?
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?
Which function should you use?
You are a database developer located in Seattle. You have a client in Melbourne, which is in a different time zone from Seattle. You have been using the datetimeoffset data type and storing data by using the Seattle offset.
You need to display the dates in the Melbourne offset.
Which function should you use?
Which expression should you use?
You have a column named TelephoneNumber that stores numbers as varchar(20). You need to write a query that returns the first three characters of a telephone number. Which expression 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?
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 Transact-SQL 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 Transact-SQL operator to display rows that exist in both tables.
Which Transact-SQL operator should you insert in line 03?
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?
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 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?
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?