Site icon IT Tutorial

Oracle SQL Tutorials – Chapter 3 (Part 1 of 3)

Chapter 3 – Single Row Functions

 

SQL FUNCTIONS

 

SINGLE ROW FUNCTIONS

 

CASE-MANIPULATIVE FUNCTIONS

SELECT first_name,

LOWER (first_name) "Lowercase",

UPPER (first_name) "Uppercase",

INITCAP (LOWER (first_name)) "First Letter"

FROM hr.employees;

 

 

SELECT first_name, last_name, job_id

FROM hr.employees

WHERE first_name = 'steven';

SELECT first_name, last_name, job_id

FROM hr.employees

WHERE LOWER (first_name) = 'steven';

 

CHARACTER FUNCTIONS

SELECT first_name,last_name,

CONCAT(first_name, last_name) "Full Name",

job_id,

LENGTH (last_name)"Length",

INSTR(last_name, 'a') "Where is'a'?",

LPAD(first_name,10,'*') "Left Padding",

RPAD(first_name,10,'-') "Right Padding",

REPLACE(first_name,'e','a')"Replace" ,

TRIM(' HELLO WORLD ') "Trim"

FROM hr.employees WHERE SUBSTR(job_id, 4) = 'REP';

 

Exit mobile version