Test 2 - Calculations Flashcards
What is the DATEDIFF syntax?
DATEDIFF(‘date_part’, date1, date2)
What does the DATE function do?
Changes string and number expressions into dates, as long as they are in a recognizable format
What function should you use if DATE does not recognize the input?
DATEPARSE
What does DATENAME do?
Returns the requested date part of a given date as a string
What is the DATENAME syntax?
DATENAME(‘date_part’, date)
What does DATEPARSE do?
returns specifically formatted strings as dates
What is the DATEPARSE syntax?
DATEPARSE(‘date_format’, “date_string”)
What does DATEPART do?
returns the name of the specified date part as an integer
What is the syntax for DATEPART?
DATEPART(‘date_part’, date)
What does MAKEDATE do?
returns a date value constructed from the specified year, month, and day
What is the syntax for MAKEDATE?
MAKEDATE(year, month, day)
What is the syntax for CONTAINS
CONTAINS(“string”, “substring”)
What is the syntax for LEFT?
LEFT(“string”, “number of characters”)
What are three functions used to change casing?
LOWER, UPPER, PROPER
What do LTRIM, RTRIM, and TRIM do?
Remove spacing from the respective sides