This scene is a bit of a comic relief to lighten the situation. Hamlet's encounter with the gravedigger explains the nature of death and is a turning point in Hamlet's character. The structure serves to move Hamlet and the audience closer to the realization that death is inevitable and universal.
This encounter provides information of Hamlet's return from England and sets the stage for Hamlet's discovery of Ophelia's death. This grants him a realistic outlook on the nature of death and his own fate. Up to this point Hamlet had concentrated on doing what his fathers ghost had prescribed. The lesson of the graveyard scene is that death is eventually inevitable. Having hamlet learn this lesson , he is more passive of his own fate and allows him to take on whatever his fate will bring.
As the graveyard scene continues, hamlet's mood is in wonder and pity. He notes that the gravedigger striking a women's skull and comments, " here's a fine revolution."
When Hamlet arrives on the scene he is shocked by the insensitive remarks made by the gravedigger. Then he reflects how it does not matter who you are in life, you will end up as a "quintessence of dust."
The mood changes dramatically as Hamlet is confronted with Yorick's skull , his childhood friend. Suddenly Hamlets takes an interest in the dead that was not present with the gravedigger. The difference between the other bones and Yorick's skull is shown by Hamlet's statement, "I knew him, Horatio." Death becomes personal to Hamlet as he holds Yorick's skull. His speech becomes more empathetic. He recognizes the similarities between Yorick's death and his own inevitable end. He says, "how abhorred in my imagination it is." The thought of his death causes him to feel sick to his stomach.