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.
Discussion:
6 comments Page 1 of 1.
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.
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.
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.
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)
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 Ram Kumar said:
8 years ago
Select enamel,max(sal) from emp.
The output is error why mean group function only one-row output.
The output is error why mean group function only one-row output.
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.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers