What preposition should we use to start a sentence where we first explain a purpose and then a method to achieve it?
Example 1
Purpose = pass the exams
Method = study a lot
In order to pass the exams, you have to study a lot.
To pass the exams, you have to study a lot.
*For passing the exams, you have to study a lot. (incorrect - see accepted answer)
Example 2
Purpose = find an object in the database
Method = run a SQL query
In order to find the object in the database, users have to run a SQL query.
To find the object in the database, users have to run a SQL query.
*For finding the object in the database, users have to run a SQL query. (incorrect - see accepted answer)