For those unfamiliar with the process, a query letter (now most often sent via email) is a short communication to an agent from a writer requesting representation. In the unusual circumstance that the writer is able to approach an editor directly, the first step is also a query. If things go well from there, subsequent submissions are a proposal and/or a "partial" (much more detailed than a query, plus a sample of writing), then a "full" (the entire manuscript).
Writers may refer to queries by other names, generally unprintable in a family venue. In other words, writing one is associated with a great deal of angst ("Did I get it right? Will they like it?"). There are two posts today that give very good examples and suggestions on writing queries. Whether you're struggling with writing a query or just curious about the workings of the publishing industry, I highly recommend to you the posts on Writer Unboxed by author Therese Walsh and CBA Rants and Ramblings by agent Rachelle Gardner.