Sunday, January 24, 2016

AVERAGE IN SQL: Display The Average of A Column From Database

Another arithmetic function in SQL is the AVERAGE function used to solve for the average of a specified column in your table.

I have two (2) tables here, the STUDENT and GRADE table. We will join the two tables using a natural join (it will display records with match only on the other table).




















For example, if we want to display the average grade of the student Rize Adora, then we will use the following query:

Query
SELECT stud_name,AVG(grade) from grade natural join student where stud_id='1'

Output


AVERAGE IN SQL: Display The Average of A Column From Database

AVERAGE IN SQL: Display The Average of A Column From Database Rating: 4.5 Diposkan Oleh: Emoblazz

0 comments:

Post a Comment