Computer Science, asked by hemashankareagl578, 7 months ago

Find the error in the following command: 2 a. Select * from Employee where DOJ is 2018-04-01; b. Select Department, salary From Company Group by Department;

Answers

Answered by poojan
10

The error will be seen in the execution of the query a. (Select * from Employee where DOJ is 2018-04-01;)

Explanation:

Actually, the sql server won't be raising a major error in both cases. However, if you go with the first statement you may not end up getting the result you must be looking for.

The reason is, you should always enclose DATE or DATETIME in single quotations whenever you are representing them in a query. Else, the server might perform the mathematical operations.

Corrected statement 'a':

Select * from Employee where DOJ is '2018-04-01';

It gives the list of employees and their respective details present in the relation who joined the company on '2018-04-01'.

While, query 2 gives the Department number, and the maximum salary from each of the respective department. But, it is always recommended to use aggregate functions to get the desired output, like if you want the average of each department's total salary, you should use average().

Learn more:

1. What are the maximum and the minimum number of rows returned by the R1 right outer join R2?

brainly.in/question/21195376

2. Write SQL commands for (a) to (e) on the basis of FAMILY relation given

below:

https://brainly.in/question/15115256

Similar questions