Want to know Lgoin/Authentication internal flow

Can anyone just guide how is login happening…m new to php and suitecrm??Where actually database query getting fired?

You can find out how the code works step by step using a debugger such as XDebug to step through the code. There is also a book for developers: SuiteCRM For Developers.