You need to create a table named MiscellaneousPayment that meets the following requirements: Which Transact-SQL statement should you run? A. B. C. D. E. F.
Suggested Answer:D
Incorrect Answers: A: For column Reason we must use nvarchar, not varchar, as multilingual values must be supported. NEWSEQUENTIALID cannot be referenced in queries. In addition, the money datatype uses rounding and will result in rounding errors. B: We cannot use INT for the Id column as new values must be automatically generated. C: For column Reason we must use nvarchar, not varchar, as multilingual values must be supported. E: NEWSEQUENTIALID cannot be referenced in queries. F: The money datatype uses rounding and will result in rounding errors. We should use decimal instead. Note: Nvarchar stores UNICODE data. If you have requirements to store UNICODE or multilingual data, nvarchar is the choice. Varchar stores ASCII data and should be your data type of choice for normal use. References: https://docs.microsoft.com/en-us/sql/t-sql/data-types/nchar-and-nvarchar-transact-sql
Both D and E fit the criteria. Nothing about performance and the comment about NEWSEQUENTIAL ID in a SQL statement doesn't apply and wasn't even part of the criteria
And what does it mean that NEWSEQUENTIALID cannot be referenced in queries for explanation that E isn't correct. You won't refer this column in INSERT statement it is default
Firstly, don't use the MONEY type.
Secondly, NEWSEQUENTIALID() can be used as a column default. But the requirement is that the ID be "globally unique". This means using the NEWID() function over the NEWSEQUENTIALID() function. NEWID() is slower and will likely cause more index fragmentation if it's on the Primary Key. But to meet the requirement, you need to use NEWID()
Guys the correct answer is E
Let me explain how:
one of the requirements for ID column says the value must be (Concentrate on must be) automatcially generated for insert opertaions. You can achieve this by both newid() as well as newsequentialID(), however newid() gives you the liberty of inserting values through an insert statement if you wish to and on the other hand in newsequentialID you cannot do that. The ID must be (again MUST be) generated automatyically no matter what.
I think both newid() and newsquentialid() allow to insert values through an insert statement
if you want to. My guess is we should choose newsquentialid() for it is better to have a squential primary key rather than a random(newid) primary key.
If you do not need a true random number I suggest you use the NEWSEQUENTIALID as it is faster to generate and also fills up a complete page due to fill factor.
The performance will depend on what you're mainly doing. For reads it is faster they are sequential, but for inserts from different sessions it is better they are randomly generated.
Anyway since we have to save data for MiscellaneousPayment for security reason maybe NEWID fits well as it is more secure, as the GUID is randomly generated, and harder to guess.
Why we cannot use Int as identity datatype?
https://docs.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql-identity-property?view=sql-server-ver15
E could be a correct answer as well. OK, we can read that NEWSEQUENTIALID cannot be referenced in queries. For example at page https://docs.microsoft.com/en-us/sql/t-sql/functions/newsequentialid-transact-sql?view=sql-server-ver15. But it is for a query like:
SELECT NEWSEQUENTIALID();
We can also read "NEWSEQUENTIALID() can only be used with DEFAULT constraints on table columns of type uniqueidentifier". It is what I have done in a database. And the query
SELECT [Id],[Reason],[Amount]
FROM [dbo].[MiscellaneousPayment]
works perfectly.
E is the correct answer because newsequentialid is more faster that newid.
https://docs.microsoft.com/en-US/sql/t-sql/functions/newsequentialid-transact-sql?view=sql-server-2017
Its no about performance. Its about generating unique key for primary key of table. Newid() is generationg unique surrogate keys and newsequentialid() is generationg nonsequentialid surrogate keys
it is the opposite, Newid() is generating nonsequential id,
and newsequentialid() is generating sequential. For the Primary Key column we want sequential. So the correct answer is E
NEWSEQUENTIALID
If privacy is a concern, do not use this function. It is possible to guess the value of the next generated GUID and, therefore, access data associated with that GUID.
upvoted 1 times
...
...
...
...
This section is not available anymore. Please use the main Exam Page.70-761 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Vermonster
4 years, 4 months agoAndy7622
4 years, 4 months agoAndy7622
4 years, 4 months agoAndy7622
4 years, 4 months agoAndy7622
4 years, 4 months agoHoglet
4 years, 4 months agoAlsari
4 years, 4 months agoHoglet
4 years, 4 months agoOooo
4 years, 7 months agoSimSql
4 years, 4 months agoSimSql
4 years, 4 months agoDeimy
4 years, 8 months agoDeimy
4 years, 8 months agomelvin9900
4 years, 9 months agoBabyBee
4 years, 5 months agoAnette
4 years, 11 months agoAnette
4 years, 11 months agodaniel_yes23
5 years agoAI_Cheong
5 years agoAnette
4 years, 11 months agoBabyBee
4 years, 5 months agoHoey
5 years, 1 month agoxd1
5 years agoJoce_IT
5 years, 5 months agoM4x
5 years, 7 months agoBartek
5 years, 7 months agoBartek
5 years, 7 months agokiri2020
4 years, 6 months agokimalto452
4 years, 4 months ago