-- https://onlinegdb.com/ryIsKw-UU
-- https://stackoverflow.com/questions/50494508
BEGIN TRANSACTION;
-- Note:
-- This online interpreter is for SQLite.
-- However, the example is valid for other SQL implementations.
-- Some dummy table
DROP TABLE IF EXISTS sales;
create table sales as
select 3 as unit_sales, 9 as total_sales;
-- The calculations
select
unit_sales/total_sales*100, --> 0 (integer)
unit_sales/total_sales*100.0, --> 0.0 (float)
100.0*unit_sales/total_sales --> 33.33 (float and expected result)
from sales;