0% found this document useful (0 votes)
3 views2 pages

SQL Function and Command Notes

The document outlines various SQL functions categorized into STRING, NUMERIC, DATE, AGGREGATE, NULL, and CONVERSION functions, detailing their uses and providing examples. STRING functions manipulate text values, NUMERIC functions handle numbers, DATE functions work with date values, AGGREGATE functions summarize multiple rows, NULL functions manage NULL values, and CONVERSION functions change data types. Each category includes specific functions along with their syntax and practical examples.

Uploaded by

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

SQL Function and Command Notes

The document outlines various SQL functions categorized into STRING, NUMERIC, DATE, AGGREGATE, NULL, and CONVERSION functions, detailing their uses and providing examples. STRING functions manipulate text values, NUMERIC functions handle numbers, DATE functions work with date values, AGGREGATE functions summarize multiple rows, NULL functions manage NULL values, and CONVERSION functions change data types. Each category includes specific functions along with their syntax and practical examples.

Uploaded by

Tejal Gole
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SQL Command and Function with syntax in details.

1. STRING FUNCTIONS

�Work on text values.

Function Use
TRIM() Remove spaces
UPPER() Convert to uppercase
LOWER() Convert to lowercase
LENGTH() Count characters
SUBSTRING() Extract part of text

Example:SELECT UPPER(name) FROM students;

2. NUMERIC FUNCTIONS

�Work on numbers.

Function Use
ROUND() Round number
ABS() Absolute value
MOD() Remainder
POWER() Exponent

Example: SELECT ROUND(95.678,2);

3. DATE FUNCTIONS

�Work on dates.

Function Use
NOW() Current date & time
CURDATE() Current date
DATEDIFF() Difference between dates

Example: SELECT CURDATE();


4. AGGREGATE FUNCTIONS

�Work on multiple rows → return one value.

Function Use
COUNT() Count rows
SUM() Total
AVG() Average
MAX() Highest value
MIN() Lowest value
Example: SELECT AVG(marks) FROM students;

5. NULL FUNCTIONS

Function Use
COALESCE() First non-NULL value
IFNULL() Replace NULL

Example:

SELECT COALESCE(phone,'Not Given') FROM students;

6. CONVERSION FUNCTIONS

Function Use
CAST() Change datatype
CONVERT() Convert datatype

Example: SELECT CAST(marks AS CHAR);

You might also like