Database - Introduction to SQL - Discussion

Discussion Forum : Introduction to SQL - True or False (Q.No. 28)
28.
The SQL statement: SELECT Name, COUNT(*) FROM NAME_TABLE; counts the number of name rows and displays this total in a table with a single row and a single column.
True
False
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
6 comments Page 1 of 1.

Gayatri said:   1 decade ago
Count(*) is an aggregate function. So for name to be displayed the select statement needs to contain a group on "name".

S P said:   1 decade ago
It will give error as a column name and aggregate functions cannot be used together.

Divya said:   1 decade ago
Please anyone explain clearly.

Lee said:   9 years ago
Aggrigate function can not be used with "where clause, group by, order by".

But it can be used with "SELECT" and "HAVING" clause.

If there is an non aggrigate column along with aggrigate column in the select list the all non aggrigate columns should appear with "GROUP BY" clause.

S Ram Kumar said:   8 years ago
Select enamel,max(sal) from emp.

The output is error why mean group function only one-row output.

Zaynab AlaaEldien said:   2 years ago
@All.

Here, it should be; SELECT Name, COUNT(*) FROM Name_TABLE GROUP BY Name;

Where (Name) is the column name you want to count its values.
(1)

Post your comments here:

Your comments will be displayed after verification.