[go: up one dir, main page]

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

Text Function

The document provides an overview of various string functions in MySQL, including UCASE, LCASE, LENGTH, LEFT, RIGHT, TRIM, INSTR, CONCAT, and SUBSTRING. Each function is explained with examples and SQL queries demonstrating their usage. Additionally, there are assessment questions related to the functions discussed.

Uploaded by

anjali222thakur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views9 pages

Text Function

The document provides an overview of various string functions in MySQL, including UCASE, LCASE, LENGTH, LEFT, RIGHT, TRIM, INSTR, CONCAT, and SUBSTRING. Each function is explained with examples and SQL queries demonstrating their usage. Additionally, there are assessment questions related to the functions discussed.

Uploaded by

anjali222thakur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

STRUCTURE QUERY

LANGUAGE
TOPIC-Database Query using SQL
SUB-TOPIC:-Text functions

CLASS-XIIB IP
String Function
MySQL has many built-in functions which are used to perform specific task.

Emp Table

1. UCASE ()/UPPER ()-: Return a string in Capital letters.


Eg:- Select upper(“Ram”);
Select name, ucase(name) from emp;
UCASE/
UPPER()
Continued….
2. LCASE ()/LOWER ():-Return a string in
small letters.
Eg:- Select lower(“KV RAIGARH”);
Select lcase(name) from emp;

3. LENGTH ():-Returns the length


of a string.
Eg:-Select length(“MySql”);

Select name, length(name) from emp;


4. LEFT(S,N) –Return N characters of S
from beginning.
Select left(‘Python’,4);

Select name, left(name,3) from emp;

5. RIGHT(S,N):-Return N characters of S
from ending .
Select right(‘python ’,4);

Select name,right(name ,3) from emp;


6. TRIM ():-Removes both side space.
Select TRIM(‘ Apple ’);

ii) LTRIM():-Removes leading/left space.


Select LTRIM(‘ Orange’);

iii) RTRIM():-Removes Trailing/Right space.


Select RTRIM(‘ Banana ’);

7. INSTR() :-It search one string in another


string and returns position, if not found 0 .
Select INSTR(‘COMPUTER’,’PUT’);
Select INSTR(‘PYTHON’,’C++’);
Continue…..
CONCAT() :-Return concatenated string.
1. Select concat(“Welcome”, “KV Raigarh”);
2. Select concat(name, “works in”, dept_name, “ department” );

SUBSTRING(S, P,N) / MID(S,P,N)-Return N


character of string S, beginning from P.
1. Select SUBSTR(‘COMPUTER’,4,3); -> “PUT”
2. Select dept_name, mid(dept_name,2,4)
from emp;
Assessment:-
Which function is used to remove only leading space from
String.
1. leftspace()
2. LEFTREMOVE()
3. LTRIM()
4. TRIM()
……… function is used to search one substring in another
string and it return………
1. search(),position
2. Insert() , index
3. Find, zero
4. Instr(), position
 What is returned by INSTR ('JAVA POINT', 'P’)?
1.6
2.7
3.POINT
4.JAVA
 What is returned by SUBSTRING(“Text Function”,6,3)?
1. unc
2. u f
3. Fun
4. None of these
Thank You

You might also like