Computer Science, asked by amisha9698, 1 month ago

any computer science student of class 12th plz solve this​

Attachments:

Answers

Answered by Equestriadash
3

(i) Select av‎g(CostPerItem) from Lab where DateOfPurcha‎se > '2015-01-01';

\begin{array}{|c|}\cline{1-1} \bf avg(CostPerItem)\\\cline{1-1}\sf 28500\\\cline{1-1}\end{array}

There are 4 items whose DateOfPurchase is greater than '2015-01-01'. They are Scanner, Camera, Hub and Ups. The average of their CostPerItem would therefore be (12000 + 25000 + 7000 + 70000)/4 = 28500.

(ii) Select sum(Operational) from Lab where CostPerItem > 20000;

\begin{array}{|c|}\cline{1-1}\bf sum(Operational)\\\cline{1-1}\sf 14\\\cline{1-1}\end{array}

There are 3 items whose CostPerItem is greater than 20000. They are Computer, Camera and Ups. The sum of their Operational would therefore be 7 + 3 + 4 = 14.

(iii) Select ItemName from Lab where Warranty > 2 and Quantity > 5;

\begin{array}{|c|}\cline{1-1}\bf ItemNa me\\\cline{1-1}\sf Computer\\\cline{1-1}\end{array}

There is 1 item whose Warranty is greater than 2 and Quantity is greater than 5. It is Computer. Therefore the ItemName would be Computer.

When checking for output-based SQL questions, it's important to first solve the 'Where' part of the command, since the output can only be determined as long as the conditions are fulfilled. Once you have an outline of the items that are to be considered, you can solve the 'Select' part of the command.

  • Avg and Sum are examples of aggregate fu‎nctions [otherwise known as multiple-row fu‎nctions].
  • Avg returns the average of the selected column.
  • Sum returns the total value of the selected column.
Answered by allysia
1

Answer:

i) 28500.000

ii)15

iii) Computer

Explanation:

i) avg(column_name) selects all the average of costs where date was after 01-01-2015

ii) sum(column_name) returns sum where cost was >20000

iii) Item names where warrant > 2 and quantity > 5;

Similar questions