Nikon 50mm 1.8D and Nikon 50mm 1.8G is pretty similiar but the build quality is different. The 1.8D is a older nikon lens where as the 1.8G is the newer nikon lens.
the 1.8G have build in motor for auto focus so smaller body like D3000, 3100, 5000, 5100 can auto focus using this lens.
the 1.8D don't have motor build in so auto focus and focus speed will depend on what camera you use. If this lens were use on body like D3000, D5000 etc that the camera doesn't have AF motor the lens will not auto focus.
Aperture wise both can wide open to 1.8, both great for low light etc.
If possible i more prefer the newer Nikon AF-S lens because it focus faster and quiet ....