A query letter is your opportunity to showcase your ability as a writer and hook the editor to accept your idea. Hook the editor with your first sentence. Let her know you have read the guidelines by including the word count, and slant for her magazine. Leave your credits or particular expertise on this subject to the last paragraph and then be brief. A query is one page, single spaced.
Editors are busy people.
Book publishers, both fiction and nonfiction, require a query. Most magazines who publish short fiction, don't but those who publish articles do. Read the guidelines carefully and follow the editorial requirements. I always include a short cover letter to remind the editor she requested the enclosed material. I include a paragraph or two about the story or article I'm enclosing.