How to calculate differences between maximum value and current value for each row? My sales table looks like this.
region          sales
======================
East            1200
Midwest         (Null)
North           2500
South           4000
West            2400

Expected query result:
region          sales     diff
================================
East            1200      2800
Midwest         0         4000
North           2500      1500
South           4000      0
West            2400      1600

The diff column is calculated by max(sales) - sales. I don't know well about SQL and I even don't know how I can write a search on google. Any help will be appreciated.
The MAX value you get in an subselect, the rest is simple math


CREATE TABLE Sales
    (`region` varchar(7), `sales` varchar(6))
;
    
INSERT INTO Sales
    (`region`, `sales`)
VALUES
    ('East', '1200'),
    ('Midwest', '(Null)'),
    ('North', '2500'),
    ('South', '4000'),
    ('West', '2400')
;




SELECT 
`region`
, `sales`
,(SELECT MAX(`sales` ) FROM Sales) - `sales` AS diff
FROM Sales


region  | sales  | diff
:------ | :----- | ---:
East    | 1200   | 2800
Midwest | (Null) | 4000
North   | 2500   | 1500
South   | 4000   |    0
West    | 2400   | 1600


db&lt;&gt;fiddle here