You are on page 1of 3

NAME: JERYWIN DULANGAN BAYAWAN DATE: 09/30/21

YEAR/COURSE/SECTION: BSIS/3/A MODULE #: 1

V. ASSESSMENT

1. Define SQL string functions in your own words based on the examples above.

Own my own understanding, sql string function is to be able to input string such as
numbers, letters to the program it also convert all data type.

2. Give at least five (5) SQL string functions and give one (1) example for each
function.

• FIRST() - Returns the first value.


• LAST() - Returns the last value.
• MAX() - Returns the largest value.
• MIN() - Returns the smallest value.
• SUM() - Returns the sum.

3. Using customer table, give the result table of the given SQL string function queries:

Customer Table
LNAME FNAME MNAME ID
Doe John C. 001
Jones Jay Y. 002
De La Cruz Juan M. 003
Adams Smith A. 004

a. Select CONCAT(lname, fname, mname,’-‘, ID) as customer From Customer


where ID IN(‘001’, ‘002’, ‘004’) order by lname

LNAME FNAME MNAME ID


Adams Smith A. 004
Doe John C. 001
Jones Jay Y. 002

b. Select UPPER(lname) as lastname, lower(fname) as firstname,


UPPER(mname) as MI From customer order by lname

LNAME FNAME MNAME


ADAMS smith A.
DE LA CRUZ juan M.
DOE john C.
JONES jay Y.
c. Select LEFT(lname, 3) as lname, RIGHT(fname, 2) as fname, LENGTH(id)
as ID From Customer order by lname

LNAME FNAME MNAME ID


Ada th A. ->004
La cruz an M. ->003
NULL hn C. ->001
es ay Y. ->002

d. Select LTRIM (lname) as ‘Last Name’ From customer where ID=’004’

LNAME ID
Adams 004

e. Select REPLACE(lname, a, e) as lname From customer order by lname

LNAME
Adaams
Dee Laa Cruz
Doee
Jonees

f. Select SUBSTRING(lname,1,2) as subLName From customer order by


fname

LNAME
Jo
Ad
Do
De

g. Select REVERSE(lname) as revName From customer order by fname

LNAME
senoJ
smadA
eoD
zurC aL eD
h. Select CONCAT(LEFT(lname, 3, RIGHT(fname, 2), LENGTH(id)) as ID
From Customer order by lname

LNAME FNAME ID
ms Smi 004
La Cruz Ju 003
NULL Jo 001
es J 002

i. Select CONCAT(UPPER(lname), ‘, ‘, lower(fname), ‘ ‘, UPPER(mname)) as


name, ID From customer order by lname

LNAME FNAME MNAME ID


ADAMS Smith A. 004
DE LA CRUZ Juan M. 003
DOE John C. 001
JONES Jay Y. 002

You might also like