Search Header Logo
Database Aggregate Functions

Database Aggregate Functions

Assessment

Presentation

Computers

10th Grade

Medium

Created by

ZUKO NDABAMBI

Used 2+ times

FREE Resource

12 Slides • 6 Questions

1

media

Computer Science(0478)

IGCSE

9. Database

SQL 3

In learning you will teach, and in teaching you will learn

2

media

Objectives

13/02/2023

Computer Science - 0478

3

media

Learning Outcomes

Grade D - E

Grade B - C

Grade A – A*

At the end of the students will be able to:

Write basic SQL script
using COUNT and SUM

Write basic SQL script using
COUNT, SUM with the
where clause

Write basic SQL script using
SELECT, WHERE, FROM,
COUNT, SUM aggregate
function, WHERE clause and
GROUP BY clause

13/02/2023

Computer Science - 0478

4

media

9.1 Database

13/02/2023

Computer Science - 0478

Aggregate function

SUM

COUNT

GROUP BY Clause

5

media

9.1 Database

Starter

Quiz on previous learning

SQL statement involving

SELECT fields FROM Table

ORDER BY clause

WHERE clause

6

Multiple Choice

Which SQL function is used to count the number of rows in a SQL query?

1

COUNT()

2

NUMBER()

3

SUM()

4

COUNT(*)

7

Multiple Choice

If you don’t specify ASC or DESC after a SQL ORDER BY clause, the following is used by default

1

ASC

2

DESC

3

There is no default value

4

None of the mentioned

8

Multiple Choice

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” ends with an “a”?

1

SELECT * FROM Persons WHERE FirstName=’a’

2

SELECT * FROM Persons WHERE FirstName LIKE ‘a%’

3

SELECT * FROM Persons WHERE FirstName LIKE ‘%a’

4

SELECT * FROM Persons WHERE FirstName=’%a%’

9

Multiple Choice

Which character returns all the data found in a table?

1

%

2

#

3

*

4

/

10

Multiple Choice

How would we script a SQL query to select "Description" from the Item table?

1

SELECT Item.Description

2

EXTRACT Description FROM Item

3

SELECT Item FROM Description

4

SELECT Description FROM Item

11

Multiple Choice

With SQL how can I return all items in the Item table sorted from the lowest priced to the highest priced?

1

SELECT * FROM Items ORDER BY Price ASCENDING

2

SELECT * FROM Items ORDER BY Price ASC

3

SELECT * FROM Items BY Price LOWEST TO HIGHEST

4

SELECT * FROM Items ORDER BY Price DESC

12

media

9.1 Database

Read, understand and complete structured query language (SQL) scripts to query data stored in a single
database table

13/02/2023

Computer Science - 0478

SQL Script

13

media

9.1 Database

Read, understand and complete structured query language (SQL) scripts to query data stored in a single
database table

13/02/2023

Computer Science - 0478

SQL Script

SELECT COUNT(fieldname1) FROM TableName

SELECT COUNT(fieldname1) AS ThisFieldName FROM TableName

Example: SELECT COUNT(*) AS Num_Orders FROM Order

14

media

9.1 Database

Read, understand and complete structured query language (SQL) scripts to query data stored in a single
database table

13/02/2023

Computer Science - 0478

SQL Script

SELECT SUM(fieldnameN) FROM TableName

SELECT SUM(fieldnameN) AS ThisFieldName FROM TableName

NOTE: FieldnameN should be numberic value

Example: SELECT SUM(Order_Value) AS Total_OrderValue FROM Orders

15

media

9.1 Database

Read, understand and complete structured query language (SQL) scripts to query data stored in a single
database table

13/02/2023

Computer Science - 0478

SQL Script

Using GROUP BY Clause

SELECT Field1, Count(Field1) FROM TableName GROUP BY Field1

Example: SELECT COUNT(Memb_Type) AS NumMembers FROM Customers

GROUP BY Memb_Type

16

media

9.1 Database

Activity

17

media

9.1 Database

Quiz

Click to host:

https://quizizz.com/admin/quiz/5e1d6315cfe055001b82dcdb?source=quiz_sh

are

18

media

9.1 Database

Plenary

Students to post on Teams collaborative space either about:

Reflection on what has been learnt

Questions they may have

Response to questions

media

Computer Science(0478)

IGCSE

9. Database

SQL 3

In learning you will teach, and in teaching you will learn

Show answer

Auto Play

Slide 1 / 18

SLIDE