"if you encounter any errors in SAP, send me a screenshot at pramod@learntosap.com, and I will help you resolve the issue."

SQL COUNT() Function Clause

SQL TUTORIALS-

SQL COUNT() Function Clause

Introduction-


Trulli Trulli

-✅COUNT() function returns the number of rows that match a specified condition or are present in a column...


Emoji Examples in HTML

🔸 Example Table: Employees

ID Customer City
1 ANNI DELHI
2 POOJA MUMBAI
3 RAJ PUNE

✅ Example 1: Count All Rows.



SELECT COUNT(*) AS TotalOrders FROM Orders;


✅Result Show :-

TotalOrders → 3 |


✅ Example 2: Count Non-NULL in a Column.



SELECT COUNT(City) AS CitiesMentioned FROM Orders;


✅Result Show :-

CitiesMentioned → 3 |


✅ Example 3: Count Orders by City (Use with GROUP BY).



SELECT City, COUNT(*) AS OrdersCount
FROM Orders
GROUP BY City;




✅Result Show :-

Emoji Examples in HTML

🔸 Example Table: Employees

City OrdersCount
DELHI 1
MUMBAI 1
PUNE 1

✅ Example 4: Count the number of employees in each department.



SELECT Department, COUNT(*) AS TotalEmployees
FROM Employees
GROUP BY Department;


May Be Like Important Link-

-How To Import Data(LSMW) LEGACY SYSTEM MIGRATION WORKBENCH

-Define Condition Type-OBYZ

-Genral Ledger Chart Of Accounts-OBD4

-Document 90039783 saved (no accounting document generated)