In act 1, scene 5, Hamlet uses this metaphor after talking with his father's ghost:
Yea, from the table of my memory
I’ll wipe away all trivial fond records (1.5.104–105)
He is specifically referring to his mother here, wishing to wipe away all evidence of any "fond" time from his childhood with her, as she has so dishonored his father. There is also a connotation in this metaphor of a mother's duties to provide for her children, alluded to with the image of a table. Hamlet is showing that his mother has failed in her responsibilities.
In another conversation with his mother, Hamlet compares his father to his uncle:
Have you eyes?
Could you on this fair mountain leave to feed
And batten on this moor? Ha, have you eyes? (3.4.73–75)
Here, Hamlet uses a metaphor to compare his father to a "fair mountain," full of beauty and opportunity with a view of the future. By comparison, his uncle is merely a "moor," empty and void of hope. He laughs at the sharp contrast of their characters and at his mother's seeming blindness to the choice she has made.
Laertes cautions his sister about Hamlet's affections:
For Hamlet and the trifling of his favor,
Hold it a fashion and a toy in blood,
A violet in the youth of primy nature (1.3.6–8)
He is using a metaphor to warn Ophelia that like a violet, the beauty of Hamlet's affections will be short-lived, and that she shouldn't put too much emotional investment into his advances.
In act 2, scene 2, Rosencrantz uses personification with a dose of irony:
None, my lord, but that the world’s grown honest.
Claudius has fetched Rosencrantz and Gildenstern to serve as spies on Hamlet, and when Hamlet asks the pair of old friends what new things are happening, this is what Rosencrantz tells him. The personification highlights that Rosencrantz himself is being anything but honest with Hamlet, and the world hasn't grown honest at all.
Claudius himself uses personification to describe Ophelia's troubles later in the play:
When sorrows come, they come not single spies
But in battalions. (4.5.87–88)
In these lines, Claudius is describing to Gertrude how much Ophelia has suffered. Her troubles have not come individually, but have attacked her all at once. He blames this "batallion" of pain for Ophelia's seeming break with sanity.
Personification and metaphors are woven throughout Hamlet to provide continually deeper and complex meanings for the characters and plot.