Dogs do what works. This means that if hanging out by the table results in getting food scraps a dog will do it. This is what humans refer to as begging. Quite frankly, if what you have smells good, a dog is probably going to be interested which will equals begging too.
At this point you’re probably assuming that feeding your dog from the table is bad. But what if we told you that you can feed your dog from the table and it won’t result in having your dog’s nose in your meal? The answer is to reward your dog while he is far away from the table. If you’re consistent with this, your dog will develop a bias towards being away from the table instead of being near it.
A great way to make this happen is to teach your dog how to “lie down” and stay on cue. You can take those skills and cue him to stay and wait for his table scrap from there. (Side note: Not all table scraps are safe for dogs. Additionally instead of using table scraps you can use dog treats.)
In conclusion, by following what is mentioned here, you are allowed to feed your dog from the table as long as you feed him while he isn’t right next to it. Regardless if you want to give table scraps or not, to decrease begging you should teach a down-stay and implement it at mealtime. During this implementation you’ll want to use rewards to reinforce the behavior making it more likely to happen again in the future.