SQL Functions QA
SQL Functions QA
5. Mid( )
(column name, start, length)
On next page
Multiple choice questions
Questions 1-5 are based on the table given below.
tbl_data
ID NAME SCORE DOB
1 Joseph 90 2001-10-01
2 Tom 85 2003-09-21
3 Harry 88 2007-02-17
4 Paul 76 2005-07-14
5 George 79 2001-11-06
1. 90
2. 85
3. 88
4. 76
1. Error
2. 0
3. 1
4. 255
1. 4
2. 3
3. 5
4. 8
1. 81.9
2. 83.6
3. 86.3
4. 85
The HAVING clause was added to SQL because the WHERE keyword could
not be used with aggregate functions.
GROUP BY clause in SQL allows you to take your result set,group it into
logical groups and then run aggregate queries on the groups.
SELECT NOW();
Answer the following
1. What are functions in SQL?
Aggregate Functions
Scalar functions
AVG()
COUNT()
FIRST()
LAST()
MAX()
MIN()
SUM()
SQL aggregate functions return a single value, calculated from the values in a
column.
SQL scalar functions return a single value for each value of a particular
column given as input.