SQL FUNCTION TUTORIAL
SQL FUNCTION ABS
In SQL Server (Transact-SQL), the ABS function returns the absolute value of a number.
ID | EmpName | Gender | Age | City |
---|---|---|---|---|
1 | Dharan | Female | 26 | Mysore |
2 | Siva Kumar | Male | 25 | Hyderbhad |
3 | Azaghu Varshith | Female | 20 | Mumbai |
4 | Ramanathan | Female | 26 | Bangalore |
SQL FUNCTION AVG
The AVG function returns the average of all values in the specified column or expression.
ID | BookName | OrderDate | Qty | DeliveryDate |
---|---|---|---|---|
1 | Troubleshooting SQL Server | 2001/05/14 23:31:5 | 8 | 2001/06/21 21:57:48 |
2 | SQL Server 2012 Black Book | 2001/04/18 1:28:3 | 18 | 2001/04/23 11:26:36 |
3 | Postgre Sql Server Programming | 2004/03/11 19:21:14 | 9 | 2004/04/18 13:1:58 |
4 | SQL Server Data Transformation Services | 1999/04/25 2:35:22 | 14 | 1999/05/28 2:6:42 |
SQL FUNCTION CEILING
This Oracle tutorial explains how to use the Oracle / PLSQL CEIL function with syntax and examples.
ID | BookName | OrderDate | Qty | DeliveryDate |
---|---|---|---|---|
1 | Programming Microsoft sql Server 2012 | 2000/10/13 14:18:39 | 17 | 2000/10/16 22:55:25 |
2 | Head First SQL | 1995/06/19 22:32:5 | 12 | 1995/07/22 23:3:48 |
3 | The Complete Guide to Oracle | 1996/05/14 9:44:20 | 17 | 1996/05/19 6:28:29 |
4 | Learing Oracle SQL & Pl/sql | 2005/09/21 22:12:56 | 14 | 2005/09/27 3:20:48 |
SQL FUNCTION CHARINDEX
The SQL CHARINDEX Function is used to find the index position of a specified expression.
ID | EmpName | Gender | Age | City |
---|---|---|---|---|
1 | Devi Mai | Female | 26 | Bangalore |
2 | Padmavathi | Male | 27 | Chennai |
3 | Pandurengan | Female | 20 | Bangalore |
4 | Harish Karthik | Female | 25 | Hyderbhad |
SQL FUNCTION CONCAT
In SQL Server (Transact-SQL), the CONCAT function allows you to concatenate strings together.
ID | EmpName | Gender | Age | City |
---|---|---|---|---|
1 | Varshini Kutty | Female | 21 | Ramnad |
2 | Sakunthala | Female | 22 | Mumbai |
3 | Pandurengan | Female | 21 | Emaneshwaram |
4 | Balan | Male | 24 | Delhi |
SQL FUNCTION COUNT
Summary: in this tutorial, you will learn how to use the SQL COUNT function to get the number of rows in a specified table.
ID | EmpName | Gender | Age | City |
---|---|---|---|---|
1 | Azaghu Varshith | Male | 31 | Madurai |
2 | Varshini Kutty | Male | 33 | Emaneshwaram |
3 | Pandurengan | Male | 23 | Nasik |
4 | Siva Kumar | Male | 24 | Mumbai |
SQL FUNCTION DATEADD
Date manipulation is a common scenario when retrieving or storing data in a SQL Server database.
ID | EmpName | Gender | Age | City |
---|---|---|---|---|
1 | Bala Murugan | Male | 27 | Paramakudi |
2 | Pandurengan | Male | 28 | Ramnad |
3 | Chandra | Male | 24 | Madurai |
4 | Hanumanthan | Male | 23 | Nasik |
SQL FUNCTION DATEDIFF
SQL Server DATEADD and DATEDIFF functions allow you to easily perform calculations such as adding or subtracting a time interval from a datetime value.
ID | EmpName | Gender | Age | City |
---|---|---|---|---|
1 | Dharan | Male | 22 | Mysore |
2 | Rishi Keshan | Female | 24 | Aruppukoottai |
3 | Chandra | Male | 26 | Hyderbhad |
4 | Hari Krishnan | Female | 23 | Aruppukoottai |
SQL FUNCTION DATEPARTS
In SQL Server (Transact-SQL), the DATEPART function returns a specified part of a given date, as an integer value.
ID | BookName | OrderDate | Qty | DeliveryDate |
---|---|---|---|---|
1 | SQL Puzzles & Answers | 2009/09/19 12:15:1 | 17 | 2009/09/23 12:40:44 |
2 | SQL Fundamentals | 2006/02/19 4:30:29 | 3 | 2006/02/25 23:46:59 |
3 | Database Systems Using Oracle | 2011/05/13 4:18:33 | 13 | 2011/05/28 2:27:1 |
4 | Securing SQL Server | 1997/06/24 11:13:13 | 19 | 1997/07/26 22:55:45 |
SQL FUNCTION FLOOR
The SQL Rounding Numbers tutorial explains how to round numbers using SQL with four different functions: CEILING, FLOOR, ROUND, and TRUNCATE.
ID | BookName | OrderDate | Qty | DeliveryDate |
---|---|---|---|---|
1 | Introduction to SQL and PL/SQL | 2008/06/22 3:51:42 | 3 | 2008/06/25 3:16:34 |
2 | SQL All-in-One For Dummies | 2000/07/17 12:43:35 | 15 | 2000/07/25 16:17:21 |
3 | Head First SQL Brain On SQL | 2008/02/12 20:32:19 | 6 | 2008/03/25 16:8:21 |
4 | The Complete Guide to SQL Server | 2001/08/13 13:1:5 | 4 | 2001/09/19 9:8:12 |
SQL FUNCTION MAX
Finding a single row from each group is easy with SQLs aggregate functions ( MIN() , MAX() , and so on).
ID | BookName | OrderDate | Qty | DeliveryDate |
---|---|---|---|---|
1 | The Complete Guide to Oracle | 2006/03/24 17:28:25 | 8 | 2006/03/26 17:50:24 |
2 | SQL Server: The Complete Reference | 2011/02/16 20:56:41 | 8 | 2011/03/24 9:47:42 |
3 | Pro Sql Server 2008 Policy based management | 2005/08/12 13:46:4 | 18 | 2005/08/23 7:47:41 |
4 | SQL Fundamentals | 2005/10/18 15:48:55 | 8 | 2005/11/24 18:20:37 |
SQL FUNCTION MID
The 1Keydata SQL Tutorial teaches beginners the building blocks of SQL. This section explains the SUBSTRING function.
ID | BookName | OrderDate | Qty | DeliveryDate |
---|---|---|---|---|
1 | SQL and Relational Theory | 2007/07/18 13:22:15 | 1 | 2007/07/23 5:39:33 |
2 | Advanced SQL Programming | 2000/01/22 9:48:35 | 15 | 2000/01/24 22:58:7 |
3 | Pro Full-text Search In SQL Server | 2000/07/14 19:9:31 | 10 | 2000/08/16 23:24:30 |
4 | Securing MySql | 2009/07/13 18:51:54 | 13 | 2009/07/16 14:52:26 |
SQL FUNCTION MIN
we are discussing the usage of SQL COUNT() function along with the SQL MIN() in a query to get a complex result.
ID | BookName | OrderDate | Qty | DeliveryDate |
---|---|---|---|---|
1 | Mastering Oracle SQL | 2005/04/20 4:58:56 | 6 | 2005/04/24 19:15:23 |
2 | SQL Weaknesses on Database Processing | 2011/07/21 17:2:41 | 8 | 2011/07/23 15:29:28 |
3 | MySql Database Internals | 1997/04/14 12:23:16 | 3 | 1997/04/27 15:4:50 |
4 | Simply SQL | 1996/09/18 20:39:45 | 17 | 1996/09/22 23:6:51 |
SQL FUNCTION NOW
The Microsoft Access Now function returns the current system date and time.
ID | BookName | OrderDate | Qty | DeliveryDate |
---|---|---|---|---|
1 | Microsoft SQL Server 2008 | 2004/01/23 19:35:39 | 12 | 2004/01/26 10:50:13 |
2 | The Complete Guide to SQL | 2006/02/20 2:15:47 | 1 | 2006/03/22 8:59:49 |
3 | Simply SQL | 2011/10/13 5:37:2 | 15 | 2011/11/25 6:44:11 |
4 | Beginning SQL Queries | 2001/01/23 22:27:37 | 2 | 2001/02/26 10:18:18 |
SQL FUNCTION RAND
Generate Random Numbers. SQL Server has a built-in function that generates a random number, the RAND() mathematical function.
ID | BookName | OrderDate | Qty | DeliveryDate |
---|---|---|---|---|
1 | The Database Language SQL | 2006/04/13 14:38:21 | 9 | 2006/04/18 7:2:8 |
2 | Red Gate Guide to SQL Server | 2010/08/12 4:57:38 | 10 | 2010/08/17 16:16:5 |
3 | The Practical SQL Handbook | 2000/05/20 7:10:48 | 3 | 2000/05/23 1:8:11 |
4 | SQL Server 2012 Black Book | 2006/01/25 20:18:18 | 3 | 2006/02/28 20:52:45 |
SQL FUNCTION REPLACE
The 1Keydata SQL Tutorial teaches beginners the building blocks of SQL. This section explains the REPLACE function.
ID | EmpName | Gender | Age | City |
---|---|---|---|---|
1 | Balan | Male | 20 | Aruppukoottai |
2 | Geetha | Male | 20 | Pune |
3 | Pandurengan | Male | 27 | Hyderbhad |
4 | Devi Mai | Female | 34 | Mysore |
SQL FUNCTION ROUND
The ROUND() function is used to round a numeric field to the number of decimals ... When rounding a number with a fractional part to an integer.
ID | EmpName | Gender | Age | City |
---|---|---|---|---|
1 | Padmavathi | Male | 30 | Chennai |
2 | Dharan | Female | 31 | Mysore |
3 | Chandra | Male | 28 | Aruppukoottai |
4 | Geetha | Female | 33 | Hyderbhad |
SQL FUNCTION SQRT
SQL SQRT Function is used to calculate square root of the input values.
ID | BookName | OrderDate | Qty | DeliveryDate |
---|---|---|---|---|
1 | Sql Server Interview Questions | 2001/04/20 11:28:27 | 5 | 2001/04/23 4:47:38 |
2 | Begining Spatial With Sql Server 2008 | 2010/04/24 4:37:56 | 8 | 2010/05/26 18:48:9 |
3 | Making Sense Of SQL | 2009/04/18 10:51:5 | 1 | 2009/05/27 21:9:12 |
4 | Pro MySql Administration | 1996/05/21 16:52:45 | 3 | 1996/06/24 12:4:19 |
SQL FUNCTION SUM
These functions are useful while performing mathematical calculations, string concatenations, sub-strings etc. SQL functions are divided into two catagories.
ID | BookName | OrderDate | Qty | DeliveryDate |
---|---|---|---|---|
1 | Oracle Concurrency | 1999/01/22 2:6:10 | 11 | 1999/01/25 18:23:28 |
2 | Pro MySql Administration | 2004/09/22 12:50:3 | 1 | 2004/09/25 11:19:30 |
3 | Pro SQL Azure | 2006/10/17 3:6:49 | 13 | 2006/10/25 12:49:32 |
4 | The Complete Guide to SQL Server | 2006/09/13 5:29:44 | 19 | 2006/09/18 11:42:29 |