MySQL Functions with query

1. String Functions

a) CONCAT()

Joins two or more strings together.



 

b) LENGTH()

Returns the length of a string in bytes.



 

c) UPPER() / LOWER()

Converts string to uppercase or lowercase.



 

d) SUBSTRING()

Extracts a substring from a string.



 


2. Numeric Functions

a) ROUND()

Rounds a number to the specified decimal places.



 

b) CEIL() / FLOOR()

Returns the next highest or lowest integer.



 

c) ABS()

Returns the absolute value.



 


3. Date and Time Functions

a) NOW()

Returns the current date and time.



 

b) CURDATE() / CURTIME()

Returns the current date or time.



 

c) DATE_ADD() / DATE_SUB()

Adds or subtracts intervals to a date.



 

d) DATEDIFF()

Calculates difference between two dates.



 


4. Aggregate Functions

a) COUNT()

Counts rows.



 

b) SUM()

Adds values.



 

c) AVG()

Calculates average value.



 

d) MAX() / MIN()

Finds the highest or lowest value.



 


5. Conditional Function

IF()

Simple conditional check.



 

CASE

More advanced conditional logic.



 


6. NULL Handling Functions

IFNULL()

Replaces NULL with a value.



 

COALESCE()

Returns the first non-NULL value.



 

CodeCapsule

Sanjit Sinha — Web Developer | PHP • Laravel • CodeIgniter • MySQL • Bootstrap Founder, CodeCapsule — Student projects & practical coding guides. Email: info@codecapsule.in • Website: CodeCapsule.in

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *