0% found this document useful (0 votes)
12 views2 pages

Case Char Student Notes

This document describes various string manipulation functions in SQL including LOWER, UPPER, INITCAP, SUBSTR, CONCAT, INSTR, LENGTH, LPAD, RPAD, and TRIM. Examples are provided to illustrate how to use these functions to select, transform, and compare string values in a database.

Uploaded by

MazMoh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Case Char Student Notes

This document describes various string manipulation functions in SQL including LOWER, UPPER, INITCAP, SUBSTR, CONCAT, INSTR, LENGTH, LPAD, RPAD, and TRIM. Examples are provided to illustrate how to use these functions to select, transform, and compare string values in a database.

Uploaded by

MazMoh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Case/Character Manipulation Function Notes LOWER/UPPER/INITCAP SELECT last_name, LOWER(first_name) FROM employees; SELECT last_name, first_name FROM employees

WHERE LOWER(first_name) = 'steven'; or SELECT job_id, job_title FROM jobs WHERE INITCAP(job_id) = 'Ad_Pres'; WHERE INITCAP(job_id) = 'Ac_Account' **both words need to have INIT caps to run SUBSTR SELECT SUBSTR(last_name, 1,6), first_name FROM employees WHERE last_name = 'Hartstein'; SELECT SUBSTR(last_name, -6,2), first_name FROM employees WHERE last_name = 'Hartstein'; SELECT last_name, first_name FROM employees WHERE SUBSTR(job_id, 4) = 'REP'; CONCAT - limited to two parameters SELECT CONCAT(first_name, last_name) FROM employees WHERE last_name = 'King'; SELECT first_name||last_name FROM employees WHERE last_name = 'King'; INSTR SELECT INSTR(last_name,'g') FROM employees WHERE last_name = 'King'; LENGTH SELECT LENGTH(last_name) FROM employees WHERE last_name = 'Grant'; LPAD/RPAD SELECT last_name, LPAD(salary,10,'*') FROM employees WHERE last_name = 'Abel'; TRIM SELECT TRIM('A' FROM job_id) FROM jobs WHERE job_id = 'AD_PRES'; SELECT TRIM('S' FROM job_id),TRIM('A' FROM job_id) FROM jobs WHERE job_id = 'AD_PRES'; SELECT TRIM(BOTH 'T' FROM 'TRENT') FROM DUAL; SELECT TRIM(LEADING 'T' FROM 'TRENT') FROM DUAL; SELECT TRIM(TRAILING 'T' FROM 'TRENT') FROM DUAL;

You might also like