Will someone please tell me where commas should go in the following sentence:
Hi, my name is Joe and I work in a button factory.
You're missing the all-important exclamation point at the end, of course.
"my name is Joe" can be completely removed from the sentence and it still makes sense. It's either a subordinating or independent clause, depending on how much you've been drinking, therefore you can surround the clause with commas to show its relative unimportance.
There are several possible options, which will give slightly different meaning and emphasis. (Punctuation often has this effect, just like stress and intonation do in speech.) The two most natural are probably:
The former of these breaks up the statement more, so stresses the sequentiality of the parts: first you’re giving your name, then where you work. The second puts the two clauses on a more equal footing: you’re giving two statements about yourself at the same time.
It would be much less likely, but one could imagine situations where a third option would work:
This version separates out “I work” as an independent assertion, with the location “in a button factory” then elaborating on it. One wouldn’t normally want to do this — usually, the significant information is where I work, not just the fact that I do — but it could make sense in response to something like “Hello, my name’s Mary, and I’m currently unemployed.”
Aside: Punctuation is amazingly powerful, almost as much as tone of voice! If we start changing other aspects of the punctuation, we can get lots more meanings out of the same words:
As others have said, a comma before the and is optional and helps express a slightly different meaning. But it should be noted that the first comma, after the Hi is required to separate Hi as an interjection. So Hi, my name is Joe.. is correct, but Hi my name is Joe... is not.