Faulty table lamps, desk lamps and floor-standing lamps, often cherished items, are usually quite easy to repair and spare parts are available. Owners are often confused, though, by the range of different types of bulb that are available. People are often very attached to a vintage table or desk lamp that maybe belonged to their grandmother, or which they took a fancy to at a car boot sale. Others are relatively new and have just stopped working. These can nearly always be fixed. Search online for table lamp spares. You should be able to find suppliers from which you can obtain all the parts you need, including brass fittings, switches, and old style cotton covered wire. You just need a very basic understanding of electricity and how to wire a plug in order to do the job safely.
Check for a frayed or loose cable which could be dangerous. Using a test meter, check the continuity of the wiring from the plug, through the switch to the lamp holder. Modern LED and electronically controlled lamps can be a little harder but you can still check for basic faults.