Demat is simply an account that allows you to hold your shares in an electronic format. A demat account converts the physical shares into an electronic form, therefore
dematerializing it. On opening a demat account, you will be given a demat account number to be able to electronically settle your trades.
A trading account is used for the buying and selling of securities. With every trade request, the securities are debited or credit from the Demat account accordingly.
A Demat account stores your stock holdings electronically, which is linked to their trading account.