Informatics Practices
If column "Salary" contains the data set {10000,15000,25000,10000,15000}, what will be the output after the execution of the given query?
SELECT SUM(DISTINCT SALARY) FROM EMPLOYEE;
- 75000
- 25000
- 10000
- 50000
SQL Queries
1 Like
Answer
50000
Reason — The DISTINCT keyword in the SUM() function ensures that only unique values of "Salary" are summed. Therefore, the query will sum up the distinct values of salary, which are 10000, 15000, and 25000, resulting in an output of 50000.
Answered By
1 Like
Related Questions
Which clause is used in query to place the condition on groups in MySQL?
- WHERE
- HAVING
- GROUP BY
- Both (i) & (ii)
If column "Marks" contains the data set {25, 35, 25, 35, 38}, what will be the output after the execution of the given query?
SELECT DISTINCT(MARKS) FROM STUDENTS;- 25, 35, 25, 35, 38
- 25, 25, 35, 35, 38
- 25, 35, 38
- 25, 25, 35, 35
What SQL statement do we use to find the total number of records present in the table Product?
- SELECT * FROM PRODUCT;
- SELECT COUNT(*) FROM PRODUCT;
- SELECT FIND(*) FROM PRODUCT;
- SELECT SUM() FROM PRODUCT;
What SQL statement do we use to display the record of all students whose last name contains 5 letters ending with "A"?
- SELECT * FROM STUDENTS WHERE LNAME LIKE '_ _ _ _A';
- SELECT * FROM STUDENTS WHERE LNAME LIKE '_ _ _ _';
- SELECT * FROM STUDENTS WHERE LNAME LIKE '????A';
- SELECT * FROM STUDENTS WHERE LNAME LIKE '*A';