MainMenu

Home Java Overview Maven Tutorials

Sunday 15 January 2017

Important & Useful functions in SQL

SQL function with example

Date : It is used to get date.

Date function In Mysql :


CURDATE() : To get date only
Now() : To get date with time
Example :
Query :
Select Now()
Result :
Now()
2016-03-25 23:28:11

Date function In SQL

GETDATE()
Example :
Query :
Select GETDATE()
Result :
No Column
2016-03-25 23:28:11

Count function In SQL


Count function is used to count the number of rows in a table.
COUNT()
Example :
Consider the below table : Salary:
Emp_idEmp_salaryEmp_name
0125000Chandan
0230000Adhiraj
0325000Akshat

Query :
Select COUNT(Emp_id)
from Salary
Result :
Emp_id
3

Tag :sql Function to get date,SQL function to count Rows

No comments:

Post a Comment