Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The Class table contains information about students, classes and grades. In this

ID: 3914939 • Letter: T

Question

The Class table contains information about students, classes and grades. In this example, we are not concerned with normalizations. The goal is the use the data provided and write SQL statements to view the desired output. The score attribute is a number data type, the DOB attribute is a date data type and all other attributes are string data types.

Part 1 – Results of a Query

A series of queries are provided to you. Use the Class table above to determine the output that would result from each query.

1. SELECT count(*) from class;

2. SELECT Distinct Ucase(className) from class;

3. SELECT className, avg(score)

FROM class

WHERE grade=’A’

GROUP BY className;

Explanation / Answer

Output:

Below are the output for all the 3 queries.

1. count

14

Explanation:

The query will return the total no of rows in the table which is 14

2.Ucase(className)

DATABASE

COMPUTER BASED IS

Explanation:

This query will return the distinct values of Class names and display it in uppercase.

3.className avg(score)

Computer Based IS 94

Database 93.33333333

Explanation:

This query will list down the Average score of students who got A grade in Both Database and Computer Based IS classes.