How to connect live and neutral and earth connection in AC devices plugged into socket?
This connection is valid.
As the plug is not polarised, the switch may end up in the live or the neutral wire. This could result in one of the lamp terminals being live, even when the switch is off. This is why you should disconnect such appliances from the wall before changing a lamp, not simply switching off. If your retained the instructions that came with your lamp, they should say this.
The ground connection to the metal case of the lamp is there for your safety, it's so that two rather than one thing has to go wrong to present a shock hazard. Without the ground connection, all that is needed is for a short from live (whichever one it happens to be) to case to make the case live. With the ground connection, such a short would blow the supply fuse.  It takes a ground connection failure as well as the short to live to make the case live now.
Fixed installations do not have the problems that an unpolarised plug and socket do, so it's possible to insist that the switch is in the live. This means you can expect all fixed appliances to not be live when the switch is off. There are many more fixed appliances than movable ones, so presumably it's thought to be worthwhile to get them the right way round. Note that strictly speaking, you should not rely on an 'off' appliance being 'not live'. Where a technician is expected to work on fixed equipment, it should be connected with a specially rated switch, which ensures 3 mm separation between the switch blades (at least according to UK regulations, YMMV in other places) for safety against mains transients of 1500 V, rather than the fraction of 1 mm needed to physically break the circuit from standard mains voltage.
So why are mobile circuits allowed to be connected to unpolarised plugs? It's been 'grandfathered' in. The first plugs and sockets used on electrical systems were unpolarised, and there are so many about that it's thought to be too unpopular to re-equip with polarised types. Unpolarised plugs are smaller and neater as well. So few people die as a direct result of a plug being inserted with switch to neutral that there's not a strong incentive to actually do anything about it.
So be careful with your movable lamp. Don't stick your fingers in it. Don't attempt to chew through the cable.