My table is--
create table mobile
(
id integer,
m_name varchar(20),
cost integer
)
and the values are --
insert into
The simplest change is to change avg(cost) as Average to (select avg(cost) from mobile) as Average. This also means that you won't need the GROUP BY clause anymore (since it doesn't do what you actually wanted):
SELECT id,
m_name AS "Mobile Name",
cost AS "Price",
(SELECT AVG(cost) FROM mobile) AS "Average",
cost - (SELECT AVG(cost) FROM mobile) AS "Difference"
FROM mobile
;