Each record in a little more detail
A and AAAA
These are the workhorses. An A record gives a name an IPv4 address and an AAAA record gives it an IPv6 address. You can have several of each for the same name, in which case resolvers rotate among them, which is a crude form of load sharing. The usual mistake is to update the A record during a move and forget the AAAA, so visitors on IPv6 networks still land on the old server.
CNAME
A canonical name record says "this name is just another name for that one". It is handy when a service gives you a hostname to point at, because they can change the address behind it without you doing anything. Two rules cause most trouble: a CNAME cannot share a name with any other record, and it cannot normally be placed on the bare domain, because that name must also carry NS and SOA records. Some DNS providers offer a workaround, sold under names like ALIAS or ANAME.
MX
Mail exchanger records say where email for the domain goes. Each has a priority number, and senders try the lowest number first, falling back to higher ones if it is unavailable. The target must be a hostname with its own A record, not an IP address and not a CNAME. If you move mail to a service like Google Workspace or Microsoft 365, you replace the old MX records entirely, since leftovers will send some of your mail to the wrong place.
TXT
Originally meant for human-readable notes, TXT records became the catch-all for machine-readable policy. SPF lives here, as do DKIM public keys, DMARC policies, and the verification strings that Google, Microsoft and others ask you to add to prove you own the domain. A name can have many TXT records, but only one of them may be an SPF record.
NS
Nameserver records state which servers are in charge of the domain. You set them at your registrar, and they must match what your DNS provider tells you to use. If the NS records at the registrar and in the zone disagree, some resolvers will see one set of answers and some another, which makes for very confusing days.
SOA
The start of authority record carries housekeeping: the primary nameserver, a contact address, a serial number that increases with each change, and timers that control how secondary servers refresh. Most people never edit it by hand, but its last field also sets how long resolvers remember that a name does not exist.
CAA
Certificate authority authorization records list which authorities may issue certificates for the domain. If you add one, remember to include whichever authority your host uses for automatic certificates, otherwise renewals will start failing without any obvious cause.
SRV
Service records point to a host and a port for a named service, with priority and weight fields. They are common in voice-over-IP, chat and some Microsoft services, and rarely used for ordinary websites.
PTR
Reverse DNS goes from an address to a name, and it is controlled by whoever owns the IP address, usually your host, not you. Mail servers check that the sending IP has a PTR record that points to a name that makes sense, which in turn resolves back to the same IP.
How a lookup works
Your device asks its resolver for a name. If the resolver does not have a fresh cached answer, it asks a root server, which points it to the servers for the top-level domain. Those point to the domain's own nameservers, and one of those returns the record. The resolver stores the answer for the length of its TTL and passes it back.
Common jobs
Pointing a domain at a new host
Find the IP address from your host, then change the A record for the bare domain and for www (or make www a CNAME to the bare domain). Lower the TTL first if you can. If your host gives you nameservers instead, change the NS records at the registrar and let the host manage the zone.
Setting up Google Workspace or Microsoft 365 mail
Remove old MX records, add the ones the provider specifies, add their SPF include to your TXT record, publish the DKIM key they generate, and add a DMARC record. Confirm domain ownership with the TXT or CNAME record they ask for.
Verifying a domain for a third-party service
The service gives you a TXT or CNAME record. Add it exactly as shown. Leave it in place afterwards, since some services recheck periodically.
Using a subdomain for a separate service
Create a CNAME (or A record) for something like shop or status. This keeps the main site and the service independent.
Checking what the world sees
Use dig example.com A, dig example.com MX or dig example.com TXT. Add @8.8.8.8 to ask a specific resolver, and +trace to follow the whole delegation chain.