Why the following statement is erroneous? SELECT dept_name, ID, avg (salary) FROM instructor GROUP BY dept_name;
- Dept_id should not be used in group by clause
- Group by clause is not valid in this query
- Avg(salary) should not be selected
- None
Explanation
- The correct answer is: Dept_id should not be used in group by clause (although this is not the case in the given query, as it uses dept_name)
- The error in the statement is that the ID column is not included in the GROUP BY clause. When using an aggregate function like AVG, all non-aggregated columns in the SELECT clause must be included in the GROUP BY clause.
Related MCQs
متعلقہ ڈیٹا کے مجموعے کو کیا کہا جاتا ہے؟
- Database
- Software
- Hardware
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
ویب پیج ڈیولپمنٹ کے لیے درج ذیل میں سے کون سی زبان استعمال ہوتی ہے؟
- HTML
- FORTRAN
- C or C++
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
ایسا سافٹ ویئر جو کمپیوٹر کو نقصان پہنچا سکتا ہے، کیا کہلاتا ہے؟
- Virus
- Server
- Extension
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
- Automatic gate
- Logic gate
- Program gate
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
ای میل کس چیز کو بھیجنے کے لیے استعمال ہوتی ہے؟
- Video
- File
- Audio
- All of these