A demat account is opened with a Depository Participant (DP) who is associated with the Central Depository Services Ltd (CDSL) or National Securities Depository Ltd (NSDL).
A trading account, on the other hand, is to transaction in the stock market, i.e. buy and sell shares. It requires registering with a stockbroker who is a member of the NSE or the BSE or any other exchange. It is a pre-requisite to have a demat and a bank account for opening this account. No annual maintenance charges are incurred on the trading account. You only have to pay the brokerage and service charges.
A demat account acts as a link between the bank account and the trading account. All transactions done through a trading account get stored in the demat account. Money gets transferred from a bank account when you buy shares using the trading account, and the shares are transferred to the demat account. When you sell securities, the shares are sold on the stock exchange by taking shares from the demat account. The money then gets transferred to your bank account. A demat account is like a hard disk used to store shares, while a trading account acts as the memory that processes them.
A demat account, however, is not required when you invest in futures and options or currencies. However, in the case of shares, you need both a trading and a demat account. A demat account gives information only about the number of shares you have and not the profit/loss you made; the trading account covers this part. It keeps track on how much money you have in your trading account and the profit/loss of previous trades, among other information.