A query letter is a sales experience. The editor is the buyer. The buyer does not want to be distracted from his day-to-day business.
The most important things to know you learn before you write the query letter.
1.) Make sure the publication you are querying accepts freelance submissions and accepts the type of work you are submitting. Otherwise, you are wasting their time and your own.
2.) Read recent issues (6 months to a year’s worth—skimming OK here) of the magazine to make sure your topic or subject area has not been covered. If it has, the editor is unlikely to run a similar piece too soon.
3.) Make your piece fit the vehicle. If the magazine’s pieces normally run a certain length, write to that length.
4.) Unless you have a substantive track record with reputable publications and some decent tear sheets, a query letter is not likely to cut it. You will do better submitting finished pieces (that follow the precepts above). Once the editor knows your work and that you deliver, a query letter is likely to be sufficient.