With the employee database from practical session 4 loaded, I enter a query on table Emp that starts with "SELECT workdept, salary, comm FROM Emp" and continues on with a WHERE condition and ends with GROUP BY workdept.
Which of the following statements is FALSE for MySQL (as based on the latest version, such as that running on the VDI solution)?
The query above will return an error message. |
||
If we modify the above query to replace salary by MAX(salary) the query will return an error message. |
||
If we modify the above query to replace salary by MAX(salary) and comm by MAX(comm) the query will return an error message. |
||
If we modify the above query to replace every attribute by the MAX of that attribute (for example, replace salary by MAX(salary) ) then the query will not return an error message. |
answer)The query above will return an error message.
Syntax for Groupby Clause:
SELECT column_name1,column_name2,-----,coumn_name_n, Aggregate_fun_name(column_name) FROM table_name WHERE condition GROUP BY column_name1,column_name2,-----,coumn_name_n; Aggregate_fun_name: SUM() , AVG(),MAX(),MIN(),COUNT(),etc. table_name: Name of the table. condition: Condition used.
the columns which used on select should all appear in group by other wise we will get error.
in given question SELECT statement contain columns workdept, salary, comm so all these three columns should apper in group by.but only one column appear in group by so we will get error message.
Get Answers For Free
Most questions answered within 1 hours.