- 相關(guān)推薦
微軟認證sql考試練習試題及答案
第1題
公司在數(shù)據(jù)庫中存儲供應商和價格信息。數(shù)據(jù)庫中的所有商品都有牌價(list price)。 你需要只將供應商Fabrikam的所有產(chǎn)品的牌價提高20.00。應使用哪個查詢?
A. UPDATE Production.Product SET ListPrice = ListPrice + 20.00 WHERE NOT EXISTS ( SELECT VendorId FROM Purchasing.Vendor WHERE VendorName = ’Fabrikam’);
B. UPDATE Production.Product SET ListPrice = ListPrice + 20.00 WHERE VendorId NOT IN ( SELECT VendorId FROM Purchasing.Vendor WHERE VendorName = ’Fabrikam’);
C. UPDATE Production.Product SET ListPrice = ListPrice + 20.00 WHERE EXISTS ( SELECT VendorId FROM Purchasing.Vendor WHERE VendorName = ’Fabrikam’);
D. UPDATE Production.Product SET ListPrice = ListPrice + 20.00 WHERE VendorId IN (SELECT VendorId FROM Purchasing.Vendor WHERE VendorName = ’Fabrikam’);
答案:D
第2題
你有名為Customer和SalesOrder的兩個表。 你需要找出尚未采購任何東西的所有客戶, 以及那些訂單總額 (OrderTotal) 不到100的客戶。應使用哪個查詢?
A. SELECT * FROM Customer WHERE 100 > ALL ( SELECT OrderTotal FROM SalesOrder WHERE Customer.CustomerID = SalesOrder.CustomerID)
B. SELECT * FROM Customer WHERE 100 > SOME ( SELECT OrderTotal FROM SalesOrder WHERE Customer.CustomerID = SalesOrder.CustomerID)
C. SELECT * FROM Customer WHERE 100 > ( SELECT MAX(OrderTotal) FROM SalesOrder WHERE Customer.CustomerID = SalesOrder.CustomerID)
D. SELECT * FROM Customer WHERE EXISTS ( SELECT SalesOrder.CustomerID FROM SalesOrder WHERE Customer.CustomerID = SalesOrder.CustomerID AND SalesOrder.OrderTotal <= 100)
答案:A
第3題
你有名為Customer和SalesOrder的兩個表。Customer表中有1000個客戶,SalesOrder表中有其中900個客戶的訂單。你 執(zhí)行下面的查詢來列出至少有一筆銷售的所有客戶。 SELECT * FROM Customer WHERE Customer.CustomerID IN (SELECT Customer.CustomerID FROM SalesOrder)
你需要確定查詢的結(jié)果。該查詢應返回什么結(jié)果?
A. 沒有行
B. 警告消息
C. Customer表中的1000行
D. Customer表中與SalesOrder表中的行匹配的900行。
答案:C
第4題
Customer表中有下面的行:CustomerId Status 1 Active 2 Active 3 Inactive 4 NULL 5 Dormant 6 Dormant 你編寫了下面 的查詢來返回狀態(tài)不為NULL或“Dormant”的所有客戶: SELECT * FROM Customer WHERE Status NOT IN (NULL, ’Dormant’) 你需要確定查詢的結(jié)果。你預計應出現(xiàn)哪個結(jié)果?
A. CustomerId Status
B. CustomerId Status 1 Active 2 Active 3 Inactive
C. CustomerId Status 1 Active 2 Active 3 Inactive 4 NULL
D. CustomerId Status 1 Active 2 Active 3 Inactive 4 NULL 5 Dormant 6 Dormant
答案:B
第5題
你有一個名為Employee的表。 你將每個員工的經(jīng)理EmployeeID插入ReportsTo列來記錄公司的組織層次結(jié)構(gòu)。你需要 編寫遞歸查詢來生成員工及其經(jīng)理的列表。 該查詢還必須包含員工在層次結(jié)構(gòu)中的級別。 你編寫了下面的代碼片段。 (包含的行號僅供參考。) 01 WITH EmployeeList (EmployeeID, FullName, ManagerName, Level)02 AS (03 ......... 04 )05 SELECT EmployeeID, FullName, ManagerName, Level06 FROM EmployeeList; 應在第3行插入哪一個代碼片段?
A. SELECT EmployeeID, FullName, ’’ AS [ReportsTo], 1 AS [Level] FROM Employee WHERE ReportsTo IS NULL UNION ALL SELECT emp.EmployeeID, emp.FullNName, mgr.FullName, 1 + 1 AS [Level] FROM Employee emp JOIN Employee mgr ON emp.ReportsTo = mgr.EmployeeID
B. SELECT EmployeeID, FullName, ’’ AS [ReportsTo], 1 AS [Level] FROM Employee WHERE ReportsTo IS NULL UNION ALL SELECT emp.EmployeeID, emp.FullName, mgr.FullName, mgr.Level + 1 FROM EmployeeList mgr JOIN Employee emp ON emp.ReportsTo = mgr.EmployeeId
C. SELECT EmployeeID, FullName, ’’ AS [Reports To], 1 AS [Level] FROM Employee UNION ALL SELECT emp.EmployeeID, emp.FullName, mgr.FullName, 1 + 1 AS [Level] FROM Employee emp LEFT JOIN Employee mgr ON emp.ReportsTo = mgr.EmployeeID
D. SELECT EmployeeID, FullName, ’’ AS [ReportsTo], 1 AS [Level] FROM Employee UNION ALL SELECT emp.EmployeeID, emp.FullName, mgr.FullName, mgr.Level + 1 FROM EmployeeList mgr JOIN Employee emp ON emp.ReportsTo = mgr.EmployeeID
答案:B
【微軟認證sql考試練習試題及答案】相關(guān)文章:
2017微軟認證考試精選練習(附答案)06-26
2017微軟認證考試模擬練習及答案09-14
2017年sql認證考試練習試題07-17
2017年sql認證考試試題及答案09-21
微軟認證考試練習題及答案10-07
2017年微軟認證考試試題及答案09-19
微軟認證考試練習題帶答案07-06