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
انکرپشن سے پہلے پیغام کی اصل قابلِ مطالعہ شکل کو کیا کہتے ہیں؟
- Ciphertext
- Plaintext
- Hashed text
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
متعلقہ ڈیٹا کے مجموعے کو کیا کہا جاتا ہے؟
- Database
- Software
- Hardware
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
اعلیٰ معیار کا سی اے ڈی سسٹم ڈرائنگ اور گرافکس پرنٹ کرنے کے لیے کس آلے کا استعمال کرتا ہے؟
- Digital plotter
- Digital picture
- Digital pixel
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
کمپیوٹر میں ہیش فنکشن کا بنیادی مقصد کیا ہے؟
- Data integrity verification and fast lookup
- Playing audio
- Increasing screen brightness
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
ایس ایس ڈی میں کس قسم کی میموری استعمال ہوتی ہے؟
- Magnetic memory
- Flash memory
- Optical memory
- None of these