Characteristics of SQL– the main characteristic of the SQL language is that is a declarative or nonprocedural language. This implies that the programmer does not need to specify step-by-step all the operations that the computer needs to carry out to obtain a particular result. Instead, the programmer indicated to the DBMS what needs to be accomplished and then let the system decided on its own how to obtain the desired results. the statement or command that compose the SQL language are generally divided into two major categories or data sublanguages. one of these sub-language known as the data definition language or DDL and the other is known as data manipulation language.
Aggregate function– aggregate functions are functions that takes a collection of values as input and return a single value. In SQL we have a five aggregates function.
- Minimum: min
- Maximum: max
- Total: sum
here, sum and function work only for number, while min, max and count work equally well for alphabetic, string
Average: avg– this function take as input, a collection of number and return a single number, which is average of all number.
SELECT AVG(amt) FROM orders;
Minimum: min– this is used to find the minimum numbers from a group of numbers. for example, suppose we want to find the amount with the minimum value from the order table.
select min( amt)
Count: count-this function is used to return the total number of value in a given attribute, means total count. For example, if we want to find a total number of annum in the order table.
Example- select count(num)
Total: sum- this is used for to return the sum of number of these numbers
Select sum( amt)
fwe want to find the sum of amount for each snum seperately.
Group by snum.