Hour 11, "Restructuring the Appearance of Data"

Quiz Answers

Match the Descriptions with the possible Functions.

DESCRIPTIONSANSWERS
a.Used to select a portion of a character string.SUBSTR
b.Used to trim characters from either the right or left of a string.LTRIM/RTRIM
c.Used to change all letters to lowercase.LOWER
d.Used to find the length of a string.LENGTH
e.Used to combine strings. (CONCATENATION is the same as ||.)CONCATENATION

1: True or false: Using functions in a select statement to restructure the appearance of data in output will also affect the way the data is stored in the database.
A1: True.
2: True or false: The outermost function is always resolved first when functions are embedded within other functions in a query.
A2: False. The innermost function is always resolved first when embedding functions within one another.

Exercise Answers

1: Use the appropriate function to convert the string hello to all uppercase letters.
A1:
SELECT UPPER('hello') FROM TABLE_NAME
									

2: Use the appropriate function to print only the first four characters of the string JOHNSON.
A2:
SELECT SUBSTR('JOHNSON',1,4) FROM TABLE_NAME
									

3: Use the appropriate function to concatenate the strings JOHN and SON.
A3: Oracle
SELECT 'JOHN' || 'SON' FROM TABLE_NAME

or

SQL Server

SELECT 'JOHN' + 'SON' FROM TABLE_NAME

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset