Butter and ghee contain glycerides of saturated fatty acids. The carbon atoms in these compounds have single bonds among them.
Cooking oil contains glycerides of unsaturated fatty acids. THe carbon atoms have double or triple bonds among them.
Bromine test can be done to differentiate between saturated and unsaturated compounds.
When a drop of bromine is added to an unsaturated compound, its (bromine's) brown color disappears due to a reaction. With saturated compoinds, bromine does not react, so there is no change in color
Butter has a much lower smoking point (this is the temperature, when we are cooking in butter or oil, at which bluish smokes come out of the fatty compoinds.
Taste ; butter gets overheated, gets burnt, and tastes bad if it is heated to high temperatur.
Oil does not taste so bad upt to a much higher temperature.