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

Functions

SQL functions are predefined operations that manipulate and process data in SQL queries. They can be categorized into aggregate functions, scalar functions, string functions, date functions, and conditional functions, each serving specific purposes such as calculations, string manipulation, and date handling. Understanding and using these functions is essential for effective data analysis and manipulation.

Uploaded by

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

Functions

SQL functions are predefined operations that manipulate and process data in SQL queries. They can be categorized into aggregate functions, scalar functions, string functions, date functions, and conditional functions, each serving specific purposes such as calculations, string manipulation, and date handling. Understanding and using these functions is essential for effective data analysis and manipulation.

Uploaded by

raagaqaran1988
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

SUBJECT : DBMS II

TOPIC : INTRODUCTION TO
SQL FUNCTIONS

Lecturer Name: YAHYE


ADAM
 SQL functions are predefined operations that
perform an action on data. They can be used in SQL
queries to manipulate and process data.

WHAT ARE THE


Marks
SQL
Average
FUNCTIONS Mark

SQL Function (AVG)


 Operate on a set of values to return a single value.

 Examples:

 SUM(): Calculates the sum of values.


 AVG(): Calculates the average of values.
1. Aggregate  COUNT(): Counts the number of rows.
Functions
 Operate on a single value and produce a single
value.

 Examples:

 UPPER(): Converts a string to uppercase.


2. Scalar  LOWER(): Converts a string to lowercase.
Functions  ROUND(): Rounds a numeric value.
 Manipulate character string values.

 Examples:

 CONCAT(): Concatenates two or more strings.


 SUBSTRING(): Extracts a portion of a string.
3. String  LENGTH(): Returns the length of a string.
Functions
 Left(): "The left function extracts a specified number of
characters from the beginning of a string.

 Right(): "The left function extracts a specified number of


characters from the end of a string.

 Trim(): The trim function removes leading and trailing


3. String spaces from a string.

Functions Con..  Replace(): The replace function replaces a specified string


with another string in a given expression

 "Instr(): The in string function finds the position of a


specified substring within a string
 Operate on date and time values.

 Examples:

 NOW(): Returns the current date and time.


 DATE_ADD(): Adds a specified time interval to a date.

4. Date 
DATEDIFF(): Calculates the difference between two dates.
Year(): Extracts the year part from the date
Functions
Performs a conditional operation based on a
specified expression

Examples:

 IF(): Checks if the condition operation is true or false.


4. Condition
Functions
 Using SQL functions involves incorporating them
into SELECT statements or other SQL clauses. Here's
a basic syntax example:

How to Use SQL


Functions
 Understanding SQL functions is crucial for effective
data manipulation and analysis. Whether you need
to perform calculations, manipulate strings, or work
with dates, SQL functions provide powerful tools for
querying and transforming data.

Conclusion
THE END THANKS!

You might also like