मराठी

Differentiate between count() and count(*) functions in SQL with appropriate examples.

Advertisements
Advertisements

प्रश्न

Differentiate between count() and count(*) functions in SQL with appropriate examples.

थोडक्यात उत्तर
फरक स्पष्ट करा
Advertisements

उत्तर

COUNT(*) returns the count of all rows in the table, whereas COUNT() is used with Column_Name passed as an argument and counts the number of non-NULL values in a column that is given as an argument.

Example: Table: EMPL

EMPNO ENAME JOB SAL DEPTNO
8270 JACK SALESMAN 2985 10
8566 ALI CLERK 9870 20
8922 AJAY NULL 8760 30
8736 BINDU CLERK 5643 20
8822 JOY MANAGER 3000 10

e.g. SELECT COUNT(*) FROM EMPL;

Output

COUNT(*)
5

e.g. SELECT COUNT(JOB) FROM EMPL;

Output

COUNT(JOB)
4

Since JOB has 1 NULL value.

shaalaa.com
Functions in SQL
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2022-2023 (March) Sample
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×