How to open demat and trading account

What steps are involved in opening both a demat and trading account together?