A foldable table mechanism, comprising: table tops; a folding assembly, wherein the folding assembly comprises at least one shelve unit and a plurality of support legs, wherein each support leg comprises movable units, the movable units are pivotably connected, the shelve unit is disposed between the table tops, the shelve unit is movably coupled to the movable units, and the support legs support and secure the table tops at an open position and are stored between the table tops at a folded position; a locking assembly for switching the movable units between the open position and the folded position wherein the locking mechanism comprises a locking pole, the movable units that are locked with each other include an upper movable unit and a lower movable unit according to relative locations of the movable units at the open position, the locking pole is disposed in a hollow section of the upper movable unit, and the locking pole is movable to extend into a first receiving unit of the lower movable unit; a trigger assembly to trigger the locking mechanism to open or fold, wherein the trigger assembly is connected to the locking mechanism; characterized in that the trigger assembly comprises: a spring body and a trigger unit connected to compress the spring body, a lower end of the spring body encases the locking pole, when the spring body is at natural state, the spring body secures the locking pole by inserting the locking pole into the lower movable unit, and when the spring body is at compressed state, the spring body secures the locking pole by removing the locking pole from the lower movable unit; an upper fastener; hinge elements; and a handrail assembly, wherein the handrail assembly comprises: a handrail body; and a locking block, wherein the handrail body and the locking block are connected to the table top by a pivot shaft, the upper fastener is connected to the handrail body by the hinge elements, and the locking block moves the upper fastener up and down along a first through hole formed in a sidewall of the upper movable unit. table tops; a folding assembly, wherein the folding assembly comprises at least one shelve unit and a plurality of support legs, wherein each support leg comprises movable units, the movable units are pivotably connected, the shelve unit is disposed between the table tops, the shelve unit is movably coupled to the movable units, and the support legs support and secure the table tops at an open position and are stored between the table tops at a folded position; a locking assembly for switching the movable units between the open position and the folded position wherein the locking mechanism comprises a locking pole, the movable units that are locked with each other include an upper movable unit and a lower movable unit according to relative locations of the movable units at the open position, the locking pole is disposed in a hollow section of the upper movable unit, and the locking pole is movable to extend into a first receiving unit of the lower movable unit; a trigger assembly to trigger the locking mechanism to open or fold, wherein the trigger assembly is connected to the locking mechanism; characterized in that the trigger assembly comprises: a spring body and a trigger unit connected to compress the spring body, a lower end of the spring body encases the locking pole, when the spring body is at natural state, the spring body secures the locking pole by inserting the locking pole into the lower movable unit, and when the spring body is at compressed state, the spring body secures the locking pole by removing the locking pole from the lower movable unit; an upper fastener; hinge elements; and a spring body and a trigger unit connected to compress the spring body, a lower end of the spring body encases the locking pole, when the spring body is at natural state, the spring body secures the locking pole by inserting the locking pole into the lower movable unit, and when the spring body is at compressed state, the spring body secures the locking pole by removing the locking pole from the lower movable unit; an upper fastener; hinge elements; and a handrail assembly, wherein the handrail assembly comprises: a handrail body; and a locking block, wherein the handrail body and the locking block are connected to the table top by a pivot shaft, the upper fastener is connected to the handrail body by the hinge elements, and the locking block moves the upper fastener up and down along a first through hole formed in a sidewall of the upper movable unit. a handrail body; and a locking block, wherein the handrail body and the locking block are connected to the table top by a pivot shaft, the upper fastener is connected to the handrail body by the hinge elements, and the locking block moves the upper fastener up and down along a first through hole formed in a sidewall of the upper movable unit.