Writing a good query letter is really hard. But you have to master the skill because a query letter gets your material in front of an editor. I'm still learning the art. But here's what I've learned so far about the whys and hows of writing a query letter.
Well, basically it's a letter whose subtext says, "hey! You should publish my book!" But, since that's a bit too bald, you need to finesse the issue. I don't know for sure, but I bet query letters get scanned pretty quick for the who and the what, and if that's not hopeless and/or completely off target, then I bet the editor flips to the synopsis to see if there's a chance the story might be interesting.
The things to convey, not necessarily in this order are:
The person reading your query is:
Use your own voice and style. I've had success with various sorts of letters, even with ones worse than the examples I've provided. I've seen query letters that are much better than the ones I write. I once read a query that made me green with envy. It was fantastic, and of course resulted in a request for the MS. But, I'd also read the MS, and so wasn't surprised to later learn the MS resulted in a rejection. See my update below before you check out my examples. Even the first two resulted in requests for the MS, but I didn't get a contract until the MS was good enough.
I recently had the opportunity to read a query letter by a writer who sigh was not me and whose agent thought it was the best query he'd ever seen. This was provided during a week-long email chat with an agent from The Writer's House hosted by Publisher's Marketplace a paid site I urge you to consider joining. The agent, of course, signed the writer and sold the book. I've provided query Example 3 which I wrote after reading that letter. I think it's way better than any I wrote before. If you're going to copy any of them, try to copy that one. Query Example 4 I did all on my own. If you're going to copy any of them, try to copy 3 or 4.