ICT3612
Assignment 3
(COMPLETE
ANSWERS)
2024 - DUE 15
July 2024
CONTACT:
, Question 1 (2 marks) Which of the following is an aggregate expression that
will find the oldest date in the invoiceDate column? 1. MIN(invoiceDate) 2.
MAX(invoiceDate) 3. HIGH(invoiceDate) 4. LOW(invoiceDate)
The correct answer is 2. MAX(invoiceDate).
Here's why:
MIN(invoiceDate) would find the earliest (minimum) date in the invoiceDate column.
MAX(invoiceDate) will find the latest (maximum) date in the invoiceDate column,
which corresponds to finding the oldest date if you interpret "oldest" as the date furthest
in the past.
HIGH(invoiceDate) and LOW(invoiceDate) are not standard SQL aggregate functions.
They are not recognized as valid aggregate functions in most database systems.
Therefore, to find the oldest date in the invoiceDate column, you should use
MAX(invoiceDate).
Question 2 (2 marks) Which of the following LIMIT clauses will return a
maximum of five rows starting with the eleventh row in the result set?
Downloaded by Corona Virus () lOMoARcPSD| 15 ICT3612/102/0/2024 1.
LIMIT 10, <= 5 2. LIMIT 11, <= 5 3. LIMIT 10, 5 4. LIMIT 11, 5
The correct answer is 4. LIMIT 11, 5.
Here's an explanation:
When using LIMIT in SQL, the syntax is typically LIMIT offset, count.
offset specifies the number of rows to skip before starting to return rows.
count specifies the maximum number of rows to return.
In this case, the question asks for a query that returns a maximum of five rows starting with the
eleventh row in the result set.
LIMIT 11, 5 means:
o 11 is the offset, indicating that the query should start retrieving rows from the
11th row in the result set.
o 5 is the count, indicating that the query should return a maximum of 5 rows.
Therefore, LIMIT 11, 5 is the correct clause to achieve the desired result of returning a
maximum of five rows starting with the eleventh row in the result set.
Assignment 3
(COMPLETE
ANSWERS)
2024 - DUE 15
July 2024
CONTACT:
, Question 1 (2 marks) Which of the following is an aggregate expression that
will find the oldest date in the invoiceDate column? 1. MIN(invoiceDate) 2.
MAX(invoiceDate) 3. HIGH(invoiceDate) 4. LOW(invoiceDate)
The correct answer is 2. MAX(invoiceDate).
Here's why:
MIN(invoiceDate) would find the earliest (minimum) date in the invoiceDate column.
MAX(invoiceDate) will find the latest (maximum) date in the invoiceDate column,
which corresponds to finding the oldest date if you interpret "oldest" as the date furthest
in the past.
HIGH(invoiceDate) and LOW(invoiceDate) are not standard SQL aggregate functions.
They are not recognized as valid aggregate functions in most database systems.
Therefore, to find the oldest date in the invoiceDate column, you should use
MAX(invoiceDate).
Question 2 (2 marks) Which of the following LIMIT clauses will return a
maximum of five rows starting with the eleventh row in the result set?
Downloaded by Corona Virus () lOMoARcPSD| 15 ICT3612/102/0/2024 1.
LIMIT 10, <= 5 2. LIMIT 11, <= 5 3. LIMIT 10, 5 4. LIMIT 11, 5
The correct answer is 4. LIMIT 11, 5.
Here's an explanation:
When using LIMIT in SQL, the syntax is typically LIMIT offset, count.
offset specifies the number of rows to skip before starting to return rows.
count specifies the maximum number of rows to return.
In this case, the question asks for a query that returns a maximum of five rows starting with the
eleventh row in the result set.
LIMIT 11, 5 means:
o 11 is the offset, indicating that the query should start retrieving rows from the
11th row in the result set.
o 5 is the count, indicating that the query should return a maximum of 5 rows.
Therefore, LIMIT 11, 5 is the correct clause to achieve the desired result of returning a
maximum of five rows starting with the eleventh row in the result set.