They say that only SQL server administrator need to know how to optimize the SQL server queries. But guess what? If you want to be known in the SQL world, you need to also know how to optimize these queries and statements used in SQL. It is through knowing them, even the basics that you would be able to offer your full expertise in maintaining or developing SQL server.
If you want to know if the query that you did is really performing well then you need to make sure that you follow the right techniques. It does not matter if they are not giving you the right result but you can always write them in different forms so that you would be able to know which works fine. If you want to get the best performance for your queries, you can use Join statements. You should prefer these kinds of statements rather than the subqueries. Most often subqueries will return different values which in turn may slow down the processing.
It is also better to use open transactions when you are trying to manipulate the data. You need to put all your DML statements inside the transaction so that you would only get a few transactions listed in your transaction logs. This is getting into the simpler form rather than executing a lot of statements. Your goal when writing SQL server query is making things simple so that manipulating and processing data would become easier for you as well as for the SQL server.