SQL Certification Exam 461 Flashcards
(135 cards)
What three things make a nonrelational query relational?
- Every element has a name
- There are no duplicates
- There is no order
Name two approximate numeric data types
1) Real
2) Float
How many bytes is a float
8
How many bytes is a real?
4
What function generates a sequential DEFAULT identifier for a UNIQUEIDENTIFIER field?
NEWSEQUENTIALID()
What column attribute requires it contain a Unique identifier?
UNIQUEIDENTIFIER
What function returns the current date?
GetDate() returns DATETIME
What year range does DATETIME support?
1753 - 9999
What function returns the most accurate DateTime value?
SYSDATETIME returns DATETIME2
What is the year range for DATETIME2?
year 0001 to 9999
What function will return a part of a date (month, day, or year) as a scalar value?
DATEPART(month, string date)
What function returns a string value for a part of a date - and the month name spelled out?
DATENAME(month, string date)
What function adds a number of days, months, or years to a date?
DATEADD(month, 1, string date)
What function returns the difference between dates in days, months, or years?
DATEDIFF(month, start date, end date )
What function returns a substring?
SUBSTRING(string date, starting, length)
What function returns the string length in characters?
LEN
What function returns the string length in bytes?
DATALENGTH
What function replaces all occurrences of characters in a string?
REPLACE(string, ‘x’, ‘y’) replaces x’s with y’s
What function produces a string repeated n times?
REPLICATE(‘xyz’, 10) repeats xyz 10 times
What function replaces a series of characters with a new string?
STUFF(string, starting, length, string)
Show a simple form of CASE statement.
CASE scalar-expression WHEN 0 THEN 'No' WHEN 1 THEN 'Yes' ELSE 'Unknown' END AS alias
Show the advanced form of CASE statement.
CASE WHEN unitPrice < 20.00 THEN 'Low" WHEN unitPrice < 40.00 THEN 'Medium' ELSE 'High' END AS priceRange
What function returns the first of its arguments that is not NULL?
COALESCE(a, b, c, …)
What function performs and IF-THEN-ELSE?
IFF(expression, true, false)