Dialogue has always been difficult for me. Writing high fantasy, with its more formal language, I've had trouble getting the right feel. The best book I've found on the subject—and I've read some that were totally useless—is Writing Dialogue by Tom Chiarella. Reading it will change the way you listen, which is the only way to learn to write good dialogue. In fact, if I were to boil the book down to its main point, it's that you must learn to listen to how other people talk, eavesdropping being a duty and a requirement for every writer. But please read the entire book, because he makes some other important points. Again, remember, you're forcing yourself to study writing the same way you would a subject in school, for the purpose of shortening the time it takes to become published.
One thing you must understand is that dialogue in a book is an artificial creation meant to represent the way we speak. None of us are as precise as written dialogue suggests. If you listen to someone speak they use umms and uhhs, stammer, and jump to new ideas at random. Just look at a courtroom transcript to see the way people really speak. So, as writers we're trying to emulate the essence of speech. For example, that's why in most books, when two people see each other, they don't go through the routine you and I would, the whole: "Hello, how are you?" "Fine, and you? How's the family?" etc. It's boring, so writers cut that part out.
Dialogue in a book needs to be precise and must always serve at least one of three purposes: giving information, showing characterization, or demonstrating conflict. If it does all three at once, that's even better. George R. R. Martin's Game of Thrones books are excellent examples. Everybody is in conflict with everybody else in each of the early chapters of the first book.
One of the things I struggle with in my own dialogue is in not making it too pointed. In real life, when my wife says, "You need to mow the lawn," I usually don't say the first thing that comes to mind, such as "I don't want to," or "How about if you do it?" I say either "Okay, I will," or I divert her attention by changing the subject. (The latter answer is a human failing on my part, and shows characterization) If your characters are always answering one another's questions, you need to think it through a little more carefully. People are subtle; so is written dialogue if done well. Some writers are masters of dialogue; the rest of us struggle.
You have to learn to understand POV (Point of View): the character or characters whose viewpoint is used in the story. I think POV is pretty simple, but it throws a lot of beginning writers. One of the reasons for this may be because there are so many different definitions for POV. The bottom line, though, is figuring out whose brain you want to use in the story. In real life, of course, you have only one POV: your own. You can empathize with other people, but you only know what they tell you or what you infer. You can't read anyone's mind (as far as I know).
In a story, you can focus through a single mind in a scene, or you can 'jump' from mind to mind, relating what any of the characters are thinking. Most writers stay inside the head of only one character per scene; that's the easiest thing for a beginning writer to do in order to learn POV. POV is not to be confused with first or third person; if you're writing in first person, (Call me Ishmael.) you will always be in that person's mind and viewpoint. In third person (His name was Ishmael.) you can use one character's thoughts throughout the story, or move around from mind to mind as necessary, though as a general guideline, for clarity's sake, most writer's stay inside one character's mind per scene or per chapter. However, writers such as Nicholas Sparks jump from mind to mind within a scene, as in his novel, The Notebook, and he seems to have done okay in the writing business.
Whichever way you want to write, you have to understand it completely. Don't get caught up in all the random terminology people use about POV unless it helps you. Just learn the process. There is a ton of information on the web about it.
I won't go into further detail on those issues. Chiarella's book gives a number of excellent examples.