You asked

Is the nikon af s 20mm f 1 8g ed good for astrophotography?

The guide doesn't cover astrophotography, so it can't say whether this lens is good for it. What it does say is that for dim light, a fast lens and a larger sensor matter more than stabilisation. On that basis, the Nikon AF-S 20mm f/1.8G ED has two things going for night work. Its f/1.8 aperture gathers plenty of light, and on full frame its 20mm view is wide enough to take in a good stretch of sky. It has no stabilisation, though, so you'll need a tripod and a steady setup rather than relying on the lens to hold the camera still.

The lens is Nikon F mount and works best on a full-frame body, where it frames as marked at 20mm. The full-frame Nikon bodies that take it include:

On an APS-C body such as the Nikon D7500, the same lens frames like 30mm, which is tighter and less suited to a wide sky. The lenses guide explains where a fast standard prime fits in a kit. The guide doesn't give prices for these pages, so check current prices at a shop before buying.

Written by Claude from this site's pages.

From these pages

This answer is for the question above. Each answer is written for the exact question in its address, so a question with its details in it (a budget, what you shoot, what you already have) gets an answer about those details. An answer draws on all 15 pages of the guide and its catalogue of 320 cameras and 1050 lenses. Another question gets its own answer at its own address, as words after /ask/. Or fill in your own: /ask/which-camera-for-{what-you-shoot}-under-{budget}-euros or /ask/which-lens-for-{what-you-shoot}-on-{your-camera}.