0% found this document useful (0 votes)
111 views

Single Row Function

Single row functions execute row by row on the input data and produce an output for each row. There are different types including character, number, date, and special functions. A DUAL table is a dummy table present in databases that is used to run functions and consumes less memory than other tables. Examples show functions like LOWER(), UPPER(), INITCAP(), REVERSE(), LENGTH() being used on the DUAL table and EMP table to manipulate and return values. Number single row functions include SQRT(), POWER(), ABS(), MOD() and ROUND() which perform operations on numeric values.

Uploaded by

Kunal Dabhane
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
111 views

Single Row Function

Single row functions execute row by row on the input data and produce an output for each row. There are different types including character, number, date, and special functions. A DUAL table is a dummy table present in databases that is used to run functions and consumes less memory than other tables. Examples show functions like LOWER(), UPPER(), INITCAP(), REVERSE(), LENGTH() being used on the DUAL table and EMP table to manipulate and return values. Number single row functions include SQRT(), POWER(), ABS(), MOD() and ROUND() which perform operations on numeric values.

Uploaded by

Kunal Dabhane
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Single row function

It executes row by row

It is a function which takes n number of inputes and generate n number of output

Types of single row function


Character single row function

Number single row function

Date single row function

Special single row function

Dummy table
a dual is a dummy table which is present in a database

LOWER

select lower('SUNDRA')
FROM DUAL;

UPPER

SELECT UPPER('SUNDRA')
FROM DUAL;

INITCAP

SELECT INITCAP('SUNDRA')
FROM DUAL;

REVERSE

SELECT REVERSE('SUNDRA')
FROM DUAL;

Single row function 1


LENGTH

SELECT LENGTH('SUNDRA')
FROM DUAL;

SELECT LENGTH(ENAME),REVERSE(ENAME) FROM EMP;

🗒 DUAL IS A DUMMY TABLE WHICH IS PRESENT IN DATABASE


VIRTUALLY WHICH CONSUMES LESS MEMORY.

Write a query to display ename,sal if the name is having exactly


5 characters

SELECT ENAME,SAL
FROM EMP
HAVING LENGTH(ENAME)=5
GROUP BY ENAME,SAL;

WRITE A QUERY TO DISPLAY ENAME,SAL IF THEY ARE


HAVING EXACTLY 5 CHARACTERS IN A NAME AND EXACTLY 4
CHARACTERS OF SALARY

SELECT ENAME,SAL
FROM EMP
WHERE LENGTH(ENAME)=5 AND LENGTH(SAL)=4;

WRITE A QUERY TO DISPLAY PALINDROME NAME

SELECT ENAME
FROM EMP
WHERE REVERSE(ENAME)=ENAME;

Single row function 2


IMPROTANT QUESTION

WRITE A QUERY TO DISPLAY WHERE LAST CHARACTER


NAME SHOULD BE CAPITAL AND OTHER CHARACTERS
SHOULD BE IN LOWER CASE

SELECT REVERSE(ENAME)
FROM (SELECT INITCAP(ENAME)
FROM (SELECT REVERSE(ENAME) FROM EMP));

SELECT REVERSE(INITCAP(REVERSE(ENAME)))
FROM EMP;

NUMBER SINGLE ROW FUNCTION


1. SQRT()

a. SQUARE ROOT

2. POWER()

a. POWER

3. ABS()

a. ABSTRACT

4. MOD(10,2)

a. REMAINDER OF 1ST NUMBER BY 2ND NUMBER

b. MOD(3,10)=3

c. MOD

FIND EVEN’TH AND ODD’TH MAXIMUM SALARIES (ASSIGNMENT QUERY)

SELECT

5.

Single row function 3


5. ROUND(55.523,1)=55.6

a. ROUND(22.6623,2)=22.66

b. ROUND(67.3456,3)= 67.346

c. THIS FUNCTION BASICALLY ROUND OF THE VALUE ACCORDING TO


THE PRECISION PROVIDED AFTER THE COMMA

d. FOR THE SCALE VALUE IT ALWAYS MAKE ADIITION TO THE PREVIOUS


NUMBER

e. BUT FOR THE PRECISION VALUE IT ALWAYS

Single row function 4

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy