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
کس قسم کے ٹرمینل میں اپنا پروسیسر ہوتا ہے اور جو آزادانہ طور پر حساب کتاب اور ڈیٹا پراسیس کر سکتا ہے؟
- Dumb Terminal
- Smart Terminal
- Intelligent Terminal
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
سافٹ ویئر یا ہارڈ ویئر میں خرابی کو بگ کہا جاتا ہے۔ اس کے لیے متبادل کمپیوٹر جرگن کیا ہے؟
- Glitch
- Squid
- Slug
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
سمورغ نامی سپر کمپیوٹر کس ملک نے تیار کیا ہے؟
- China
- Japan
- Iran
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
سی پی یو کے اندر کون سی میموری نصب ہوتی ہے؟
- RAM
- ROM
- Register
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
ورلڈ وائیڈ ویب کو رابرٹ کیلِیو کے ساتھ کس نے ایجاد کیا؟
- Tom Burne
- Tim Burner Lee
- Fred Zuckerberg
- Both a and b