SQL Functions   «Prev 

Concatenation and SUBSTR - Exercise

Database: Oracle AI Database 26ai. Write your answer using the table and column names supplied below.

Objective: Explain string concatenation and character extraction.

Assume Authors has VARCHAR2 columns au_Fname and au_Lname with these rows. NULL means a missing value, not the text "NULL".

au_Fnameau_Lname
SarahBuchman
NULLKellsey

Queries to interpret

SELECT au_Fname || ' ' || au_Lname AS FullName
FROM Authors;
SELECT SUBSTR(au_Lname, 1, 3) AS LastNamePrefix
FROM Authors;
  1. Write the output of each query for both sample rows. Without ORDER BY, row order is not guaranteed.
  2. Explain the space literal and the two numeric arguments to SUBSTR.
  3. Explain what happens to the concatenated value when au_Fname is NULL in Oracle.

How to submit: Enter your SQL and reasoning, then select Submit to compare with the model solution. This is a self-assessment: the website does not connect to a database or execute your SQL.