Download Provisioning SQL Databases.70-765.Briefmenow.2017-12-07.106q.vcex

Vendor: Microsoft
Exam Code: 70-765
Exam Name: Provisioning SQL Databases
Date: Dec 07, 2017
File Size: 4 MB

How to open VCEX files?

Files with VCEX extension can be opened by ProfExam Simulator.

Demo Questions

Question 1
Your database contains a table named Purchases. The table includes a DATETIME column named PurchaseTime that stores the date and time each purchase is made. There is a non- clustered index on the PurchaseTime column. The business team wants a report that displays the total number of purchases made on the current day. You need to write a query that will return the correct results in the most efficient manner. Which Transact-SQL query should you use?
  1. SELECT COUNT(*)FROM Purchases
    WHERE PurchaseTime = CONVERT(DATE, GETDATE())
  2. SELECT COUNT(*)FROM Purchases
    WHERE PurchaseTime = GETDATE()
  3. SELECT COUNT(*)FROM Purchases
    WHERE CONVERT(VARCHAR, PurchaseTime, 112) =
    CONVERT(VARCHAR, GETDATE(), 112)
  4. SELECT COUNT(*)FROM Purchases
    WHERE PurchaseTime >= CONVERT(DATE, GETDATE())
    AND PurchaseTime <DATEADD(DAY, 1, CONVERT(DATE, GETDATE()))
Correct answer: D
Explanation:
To compare a time with date we must use >= and > operators, and not the = operator.Incorrect Answers:A: The in WHERE clause there is an incorrect comparison between time and a date, as equality (=) is used.http://technet.microsoft.com/en-us/library/ms181034.aspx
To compare a time with date we must use >= and > operators, and not the = operator.
Incorrect Answers:
A: The in WHERE clause there is an incorrect comparison between time and a date, as equality (=) is used.
http://technet.microsoft.com/en-us/library/ms181034.aspx
Question 2
You develop a Microsoft SQL Server 2012 database that contains a heap named OrdersHistorical.
You write the following Transact-SQL query:
  • INSERT INTO OrdersHistorical
  • SELECT * FROM CompletedOrders
You need to optimize transaction logging and locking for the statement.
Which table hint should you use?
  1. HOLDLOCK
  2. ROWLOCK
  3. XLOCK
  4. UPDLOCK
  5. TABLOCK
Correct answer: E
Explanation:
When importing data into a heap by using the INSERT INTO SELECT <columns> FROM statement, you can enable optimized logging and locking for the statement by specifying the TABLOCK hint for the target table.https://docs.microsoft.com/en-us/sql/t-sql/queries/hints-transact-sql-table
When importing data into a heap by using the INSERT INTO SELECT <columns> FROM statement, you can enable optimized logging and locking for the statement by specifying the TABLOCK hint for the target table.
https://docs.microsoft.com/en-us/sql/t-sql/queries/hints-transact-sql-table
Question 3
You administer a SQL Server 2012 server that contains a database named SalesDb. SalesDb contains a schema named Customers that has a table named Regions. A user named UserA is a member of a role named Sales. UserA is granted the Select permission on the Regions table. The Sales role is granted the Select permission on the Customers schema.
You need to ensure that the following requirements are met:
The Sales role does not have the Select permission on the Customers schema. UserA has the Select permission on the Regions table.
Which Transact-SQL statement should you use?
  1. REVOKE SELECT ON Schema::Customers FROM UserA
  2. DENY SELECT ON Object::Regions FROM UserA
  3. EXEC sp_addrolemember 'Sales', 'UserA'
  4. DENY SELECT ON Object::Regions FROM Sales
  5. REVOKE SELECT ON Object::Regions FROM UserA
  6. DENY SELECT ON Schema::Customers FROM Sales
  7. DENY SELECT ON Schema::Customers FROM UserA
  8. EXEC sp_droprolemember 'Sales', 'UserA'
  9. REVOKE SELECT ON Object::Regions FROM Sales
  10. REVOKE SELECT ON Schema::Customers FROM Sales
Correct answer: J
Explanation:
Use REVOKE to remove the grant or deny of a permission.https://docs.microsoft.com/en-us/sql/t-sql/statements/permissions-grant-deny-revoke-azure-sqldata-warehouse-parallel-data-warehouse
Use REVOKE to remove the grant or deny of a permission.
https://docs.microsoft.com/en-us/sql/t-sql/statements/permissions-grant-deny-revoke-azure-sqldata-warehouse-parallel-data-warehouse
Question 4
You use Microsoft SQL Server 2012 to develop a database application. You need to create an object that meets the following requirements:
  • Takes an input variable
  • Returns a table of values
  • Cannot be referenced within a view
Which object should you use?
  1. Scalar-valued function
  2. Inline function
  3. User-defined data type
  4. Stored procedure
Correct answer: D
Explanation:
Stored procedures accept input parameters and return multiple values in the form of output parameters to the calling program. They cannot be used in views.https://docs.microsoft.com/en-us/sql/relational-databases/stored-procedures/stored-proceduresdatabase-engine
Stored procedures accept input parameters and return multiple values in the form of output parameters to the calling program. They cannot be used in views.
https://docs.microsoft.com/en-us/sql/relational-databases/stored-procedures/stored-proceduresdatabase-engine
Question 5
You are a database developer for an application hosted on a Microsoft SQL Server 2012 server. The database contains two tables that have the following definitions:
  
Global customers place orders from several countries. You need to view the country from which each customer has placed the most orders.
Which Transact-SQL query do you use?
  1. SELECT c.CustomerID, c.CustomerName, o.ShippingCountry FROM Customer cINNER JOIN
    (SELECT CustomerID, ShippingCountry,
    RANK() OVER (PARTITION BY CustomerID
    ORDER BY COUNT(OrderAmount) DESC) AS Rnk
    FROM Orders
    GROUP BY CustomerID, ShippingCountry) AS o
    ON c.CustomerID = o.CustomerID
    WHERE o.Rnk = 1
  2. SELECT c.CustomerID, c.CustomerName, o.ShippingCountry FROM(SELECT c.CustomerID, c.CustomerName, o.ShippingCountry, RANK()
    OVER (PARTITION BY CustomerID
    ORDER BY COUNT(o.OrderAmount) ASC) AS Rnk
    FROM Customer c
    INNER JOIN Orders o
    ON c.CustomerID = o.CustomerID
    GROUP BY c.CustomerID, c.CustomerName, o.ShippingCountry) cs WHERE Rnk = 1
  3. SELECT c.CustomerID, c.CustomerName, o.ShippingCountry FROM Customer cINNER JOIN
    (SELECT CustomerID, ShippingCountry,
    RANK() OVER (PARTITION BY CustomerIDORDER BY OrderAmount DESC) AS Rnk
    FROM Orders
    GROUP BY CustomerID, ShippingCountry) AS o
    ON c.CustomerID = o.CustomerID
    WHERE o.Rnk = 1
  4. SELECT c.CustomerID, c.CustomerName, o.ShippingCountry FROM Customer cINNER JOIN
    (SELECT CustomerID, ShippingCountry,
    COUNT(OrderAmount) DESC) AS OrderAmount
    FROM Orders
    GROUP BY CustomerID, ShippingCountry) AS o
    ON c.CustomerID = o.CustomerID
    ORDER BY OrderAmount DESC
Correct answer: A
Explanation:
Use descending (DESC) ordering.To order by the number of orders we use ORDER BY COUNT(OrderAmount).Finally a WHERE close is needed: WHERE o.Rnk = 1Incorrect Answers:B: The ascending (ASC) sorting would produce the country from which each customer has placed the least orders.C: We are interested in the number of the orders, not the amount of the orders. We should use ORDER BYCOUNT(OrderAmount), not ORDER BY OrderAmount.D: We are only interested in one single post, only the country from which each customer has placed the most orders. Need to use a WHERE statement (here Where o.Rnk =1 ).
Use descending (DESC) ordering.
To order by the number of orders we use ORDER BY COUNT(OrderAmount).
Finally a WHERE close is needed: WHERE o.Rnk = 1
Incorrect Answers:
B: The ascending (ASC) sorting would produce the country from which each customer has placed the least orders.
C: We are interested in the number of the orders, not the amount of the orders. We should use ORDER BY
COUNT(OrderAmount), not ORDER BY OrderAmount.
D: We are only interested in one single post, only the country from which each customer has placed the most orders. Need to use a WHERE statement (here Where o.Rnk =1 ).
Question 6
You use a Microsoft SQL Server 2012 database that contains two tables named SalesOrderHeader and SalesOrderDetail. The indexes on the tables are as shown in the exhibit.
(Click the Exhibit button.)
You write the following Transact-SQL query:
   
You discover that the performance of the query is slow. Analysis of the query plan shows table scans where the estimated rows do not match the actual rows for SalesOrderHeader by using an unexpected index on
SalesOrderDetail.
You need to improve the performance of the query.
What should you do?
  1. Use a FORCESCAN hint in the query.
  2. Add a clustered index on SalesOrderId in SalesOrderHeader.
  3. Use a FORCESEEK hint in the query.
  4. Update statistics on SalesOrderId on both tables.
Correct answer: D
Explanation:
New statistics would be useful.The UPDATE STATISTICS command updates query optimization statistics on a table or indexed view. By default, the query optimizer already updates statistics as necessary to improve the query plan; in some cases you can improve query performance by using UPDATE STATISTICS or the stored procedure sp_updatestats to update statistics more frequently than the default updates.http://msdn.microsoft.com/en-us/library/ms187348.aspx
New statistics would be useful.
The UPDATE STATISTICS command updates query optimization statistics on a table or indexed view. By default, the query optimizer already updates statistics as necessary to improve the query plan; in some cases you can improve query performance by using UPDATE STATISTICS or the stored procedure sp_updatestats to update statistics more frequently than the default updates.
http://msdn.microsoft.com/en-us/library/ms187348.aspx
Question 7
You use Microsoft SQL Server 2012 to develop a database application. You need to implement a computed column that references a lookup table by using an INNER JOIN against another table.
What should you do?
  1. Reference a user-defined function within the computed column.
  2. Create a BEFORE trigger that maintains the state of the computed column.
  3. Add a default constraint to the computed column that implements hard-coded values.
  4. Add a default constraint to the computed column that implements hard-coded CASE statements.
Correct answer: A
Explanation:
A common way to define a computed column is by using a user-defined function (UDF) to encapsulate the calculation logic.https://blogs.msdn.microsoft.com/sqlcat/2011/11/28/a-computed-column-defined-with-a-userdefined-function-might-impact-query-performance/
A common way to define a computed column is by using a user-defined function (UDF) to encapsulate the calculation logic.
https://blogs.msdn.microsoft.com/sqlcat/2011/11/28/a-computed-column-defined-with-a-userdefined-function-might-impact-query-performance/
Question 8
You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit. 
  
You need to display rows from the Orders table for the Customers row having the CustomerId value set to 1 in the following XML format.
  
Which Transact-SQL query should you use?
  1. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId = Customers-CustomerId
    WHERE Customers.CustomerId = 1
    FOR XML RAW
  2. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN Customers
    ON Orders.CustomerId = Customers.CustomerId
    WHERE Customers.CustomerId = 1
    FOR XML RAW, ELEMENTS
  3. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId = Customers.CustomerId
    WHERE Customers.CustomerId = 1
    FOR XML AUTO
  4. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId = Customers.CustomerId
    WHERE Customers.CustomerId= 1
    FOR XML AUTO, ELEMENTS
  5. SELECT Name, Country, OrderId, OrderDate, AmountFROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId= Customers.CustomerId
    WHERE Customers.CustomerId= FOR XML AUTO
  6. SELECT Name, Country, Crderld, OrderDate, AmountFROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId= Customers.CustomerId
    WHERE Customers.CustomerId= FOR XML AUTO, ELEMENTS
  7. SELECT Name AS `@Name', Country AS `@Country', OrderId, OrderDate, AmountFROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId= Customers.CustomerId
    WHERE Customers.CustomerId = 1
    FOR XML PATH (`Customers')
  8. SELECT Name AS `Customers/Name', CountryAS `Customers/Country', OrderId, OrderDate, AmountFROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId= Customers.CustomerId
    WHERE Customers.CustomerId= 1
    FOR XML PATH (`Customers'
Correct answer: G
Question 9
You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit.
 
You need to display rows from the Orders table for the Customers row having the CustomerId value set to 1 in the following XML format.
  
Which Transact-SQL query should you use?
  1. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId = Customers-CustomerId
    WHERE Customers.CustomerId = 1
    FOR XML RAW
  2. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId = Customers.CustomerId
    WHERE Customers.CustomerId = 1
    FOR XML RAW, ELEMENTS
  3. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId = Customers.CustomerId
    WHERE Customers.CustomerId = 1FOR XML AUTO
  4. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId Customers.CustomerId
    WHERE Customers.CustomerId= 1
    FOR XML AUTO, ELEMENTS
  5. SELECT Name, Country, Orderld, OrderDate, AmountFROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId= Customers.CustomerId
    WHERE Customers.CustomerId= 1
    FOR XML AUTO, ELEMENTS
  6. SELECT Name, Country, Crderld, OrderDate, AmountFROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId= Customers.CustomerId
    WHERE Customers.CustomerId= FOR XML AUTO, ELEMENTS
  7. SELECT Name AS `@Name', CountryAS `@Country', OrderId, OrderDate, Amount
    FROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId= Customers.CustomerId
    WHERE Customers.CustomerId= 1
    FOR XML PATH (`Customers')
  8. SELECT Name AS `Customers/Name', CountryAS `Customers/Country', OrderId, OrderDate, Amount
    FROM Orders
    INNER JOIN Customers
    ON Orders.CustomerId= Customers.CustomerId
    WHERE Customers.CustomerId= 1
    FOR XML PATH (`Customers'
Correct answer: E
Question 10
You are a database developer of a Microsoft SQL Server 2012 database. You are designing a table that will store Customer data from different sources. The table will include a column that contains the CustomerID from the source system and a column that contains the SourceID. A sample of this data is as shown in the following table.
  
You need to ensure that the table has no duplicate CustomerID within a SourceID. You also need to ensure that the data in the table is in the order of SourceID and then CustomerID. Which Transact- SQL statement should you use?
  1. CREATE TABLE Customer(SourceID int NOT NULL IDENTITY,
    CustomerID int NOT NULL IDENTITY,
    CustomerName varchar(255) NOT NULL);
  2. CREATE TABLE Customer(SourceID int NOT NULL,
    CustomerID int NOT NULL PRIMARY KEY CLUSTERED,
    CustomerName varchar(255) NOT NULL);
  3. CREATE TABLE Customer(SourceID int NOT NULL PRIMARY KEY CLUSTERED,
    CustomerID int NOT NULL UNIQUE,
    CustomerName varchar(255) NOT NULL);
  4. CREATE TABLE Customer(SourceID int NOT NULL,
    CustomerID int NOT NULL,
    CustomerName varchar(255) NOT NULL,
    CONSTRAINT PK_Customer PRIMARY KEY CLUSTERED
    (SourceID, CustomerID));
Correct answer: D
HOW TO OPEN VCE FILES

Use VCE Exam Simulator to open VCE files
Avanaset

HOW TO OPEN VCEX FILES

Use ProfExam Simulator to open VCEX files
ProfExam Screen

ProfExam
ProfExam at a 20% markdown

You have the opportunity to purchase ProfExam at a 20% reduced price

Get Now!