KI ist überall, aber kaum in Produktivitätszahlen sichtbar

The Register – Headlines Original ≈1 Min. Lesezeit
Anzeige
In MySQL you can count the number of rows in a table with the `COUNT()` aggregate function. For the table **`users`** the simplest query is: ```sql SELECT COUNT(*) AS total_rows FROM users; ``` ### What this does - `COUNT(*)` counts **every row** in the table, regardless of whether any column is `NULL`. - The result will be a single row with a column named `total_rows` (you can rename it to anything you like). ### If you need a conditional count If you only want to count rows that meet a certain condition, add a `WHERE` clause: ```sql SELECT COUNT(*) AS active_users FROM users WHERE status = 'active'; ``` ### Quick tip - `COUNT(column_name)` counts only rows where that column is **not** `NULL`. - `COUNT(*)` is the most common way to get the total number of rows. That’s all you need to know to get the row count in MySQL!

Ähnliche Artikel