Concept explainers
Aggregate Functions:
SQL has some built-in functions and they are called as aggregate functions. SQL contains five built-in functions. They are:
- SUM – This function is used to add values from the particular column.
- Syntax: SELECT SUM(column_Name) FROM table_Name;
- COUNT – This is used to count the number of rows for the particular column.
- Syntax: SELECT COUNT(column_Name) FROM table_Name;
- MAX – This function is used to get the maximum value from the column.
- Syntax: SELECT MAX(column_Name) FROM table_Name;
- MIN – This function is used to get the minimum value from the column.
- Syntax: SELECT MIN(column_Name) FROM table_Name;
- AVG – This function is used to get the average of all the values from the column.
- Syntax: SELECT AVG(column_Name) FROM table_Name;
DISTINCT Keyword: “DISTINCT” keyword is used to avoid redundant data (removing duplicate values) from a column. The syntax for “DISTINCT” keyword is as follows:
SELECT DISTINCT column_Name FROM table_Name;
WHERE clause:
“WHERE” statement is used limit the number of rows. For example: Consider a table “FTable” that has two columns named “FruitName” and “Color”. “WHERE” clause is used when there is a need to display the entire FruitName whose color is Red.
SELECT * FROM FTable WHERE color = 'red';
When the above statement is executed, red colored fruits get displayed.
Trending nowThis is a popular solution!
Chapter 7 Solutions
Bundle: Database Systems: Design, Implementation, & Management, Loose-leaf Version, 12th + Lms Integrated For Mindtap Computing, 1 Term (6 Months) Printed Access Card
- Database Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781305627482Author:Carlos Coronel, Steven MorrisPublisher:Cengage Learning