String
Operations
&
Aggregate
Functions
Team members:
Devashree Poonekar 120A7038
Sahil Saini 120A7046
Sachet Utekar 120A7058
Table of Contents
Why we need them ?
String Operation
Aggregate Functions
Conclusion
Why we do need them ?
String Operations Aggregate function
Like condition is Aggregation function
used to perform is used to perform
pattern matching for the calculations on
identifying the exact multiple rows of a
outcome single column of a
table.
Like Operator “%”
The LIKE is a logical operator in the Structured Query
Language. This SQL operator is used in the WHERE clause
with the following three statements:
1. SELECT Statement
2. UPDATE Statement
3. DELETE Statement
Following are two wildcard characters that are used either in
conjunction or independently with the SQL LIKE operator:
1. % (percent sign): This wildcard character matches zero,
one, or more than one character.
2. _ (underscore sign): This wildcard character matches only
one or a single character.
Database:
Like example: Like example:
Output: Output:
Aggregate Functions
Count
Sum
Avg
Max
Min
Count ( )
● COUNT function is used to Count the number of
rows in a database table. It can work on both
numeric and non-numeric data types.
● COUNT function uses the COUNT(*) that returns the
count of all the rows in a specified table. COUNT(*)
considers duplicate and Null.
● SQL COUNT Syntax:
SELECT COUNT(column_name)FROM table_name
Database:
Count example:
Output:
Sum ( )
Sum function is used to calculate the sum of all
selected columns. It works on numeric fields
only.
Database:
Sum Example:
Output:
Avg ( )
The AVG function is used to
calculate the average value of the
numeric type. AVG function returns
the average of all non-Null values.
Database:
Avg Example:
Output:
Max ( )
MAX function is used to find
the maximum value of a
certain column. This function
determines the largest value of
all selected values of a
column.
Database:
Max Example:
Output:
Min( )
MIN function is used to find the
minimum value of a certain column.
This function determines the smallest
value of all selected values of a
column.
Database:
Min Example:
Output:
Problems
Problem 1: List down all the records where location is ‘California’
and salary is maximum
Query:
Output:
Problem 2: List down all the records where persons names ends
with ‘rk’ and has got maximum salary
Query:
Output:
Problem 3: List all the records where location is ‘California’ and
age is between 30 to 35
Query:
Output:
Problem 4: List down all the records where name starts with ‘k’
and ends with ‘m’
Query:
Output:
Problem 5: List down all the records where name consists of at
least one ‘e’
Query:
Output: