select a.TrainNo,a.Amount,b.Carried,a.Amount-b.Carried Leave,b.Carried/a.Amount ratio
from A a,B b
where a.TrainNo=b.TrainNo