MySQL read/write ratio from information_schema.GLOBAL_STATUS Could you please help me to construct a query to sum specific rows from a table, basically desired output is:

+-----------------+----------------+
| Total reads     | Total writes   |
+-----------------+----------------+
| 345436          | 345435         |
+-----------------+----------------+



Total reads = Com_select
Total writes = Com_delete, Com_insert, Com_update, Com_replace
Use the typical trick of sum(IF the column is the right one, use it, if not read 0:

SELECT sum(IF(variable_name = 'Com_select', variable_value, 0)) as `Total reads`,
       sum(IF(variable_name IN ('Com_delete', 'Com_insert', 'Com_update', 'Com_replace'),
           variable_value, 0)) as `Total writes` 
FROM information_schema.GLOBAL_STATUS;