where / andWhere

Sometimes when writing queries we may have condition parts of the query.

So how do I know whether to use a where or an andWhere?