Informatics Practices
In the table 'Student' in MySQL, if column 'Fees' contains the data (5000, 8000, 7500, NULL, 5000, 8000), what will be the output after the execution of the given query?
SELECT COUNT(DISTINCT Fees) FROM student;
Answer
The above query will return 3 as the output.
Explanation
The query SELECT COUNT(DISTINCT Fees) FROM student; returns 3 because it counts the unique non-null values in the Fees column of the Student table. In the given data (5000, 8000, 7500, NULL, 5000, 8000), the distinct non-null values are 5000, 8000, and 7500. The NULL value is excluded from the distinct count, resulting in a count of 3.
Related Questions
E-waste is harmful to the environment and human health if not properly treated or disposed of, therefore they must be handled with care. What are the health hazard which can be caused by E-waste ?
- Lung cancer
- DNA damage
- Brain damage
- All of the above
What will be returned by the given query?
SELECT RIGHT("LEFT", 2) ;Online …………… is a theft of personal information in order to commit a fraud.
Identify the Single Row function of MySQL among the following:
- Trim ()
- Max ()
- Avg()
- Count()