A Guide to SQL
A Guide to SQL
9th Edition
ISBN: 9781111527273
Author: Philip J. Pratt
Publisher: Course Technology Ptr
Question
Book Icon
Chapter 4, Problem 14CAT
Program Plan Intro

“SELECT” command:

The “SELECT” command is used to retrieve data in a database.

Syntax for selecting values from the table is as follows:

SELECT STUDENT_ID FROM STUDENT;

  • The given query is used to display each student ID from “STUDENT” table.

“AVG” function:

  • It is the one function of aggregate function.
  • The “AVG” function is used to compute the average value in a column.

Example:

The example for “AVG” function is given below:

SELECT AVG(MARK_CREDIT) FROM STUDENT;

The above query is used to display the average of mark credit from “STUDENT” table using “AVG” function.

“GROUP BY” Clause:

  • User can group the data using “GROUP BY” clause.
  • This clause allows the user to group data on a specific column and then computes statistics when user preferred.

Example:

The example for “GROUP BY” clause is given below:

SELECT CUSTOMER_NAME, SUM(AMOUNT) FROM CUSTOMERS GROUP BY CUSTOMER_NAME;

The above query is used to list the customer name and the sum of amount using “GROUP BY” clause.

Blurred answer
Students have asked these similar questions
List the location number and unit number for every condo whose square footage is equal to or less than 1,084 square feet.
Determine the sorts of books that are presently available in the inventory. Only one of each category should be included.
Find the rep number, last name, and first name of each sales rep who represents at least one customer with a credit limit of $10.000

Chapter 4 Solutions

A Guide to SQL

Knowledge Booster
Background pattern image
Recommended textbooks for you
  • Text book image
    A Guide to SQL
    Computer Science
    ISBN:9781111527273
    Author:Philip J. Pratt
    Publisher:Course Technology Ptr
    Text book image
    Oracle 12c: SQL
    Computer Science
    ISBN:9781305251038
    Author:Joan Casteel
    Publisher:Cengage Learning
Text book image
A Guide to SQL
Computer Science
ISBN:9781111527273
Author:Philip J. Pratt
Publisher:Course Technology Ptr
Text book image
Oracle 12c: SQL
Computer Science
ISBN:9781305251038
Author:Joan Casteel
Publisher:Cengage Learning