What exactly is the difference?
A look at the "Under-Side" of the World Wide Web.
(continued from Part 1)
When you register a domain name you register something like "mydomain.com".
While this is commonly referred to as a "domain name" it is actually made up of
two distinct parts, separated by a period. To break it down it is easiest to
understand if we start on the right. The first part, "com" in our example, is
known as a Top Level Domain, or TLD. Information about a Top Level Domain is
kept in a centralized database commonly called the "Root Server Database" or
sometimes the "Registry Database".
From a logical perspective (it could be physically implemented in a variety of ways) there is one database for each TLD such as "com", "net", "info" etc. Each TLD database contains entries for names of Second Level Domains. The second part of our domain name, "mydomain", is an example of a Second Level Domain. Certain organizations, known as Domain Registrars, have been authorized to add or modify entries in these TLD databases. The process of registering a domain is actually the process of having an entry added to the appropriate TLD database. These entries point to databases that each contain entries for one or more of these Second Level Domains. These databases are held on server systems running DNS (Domain Name System) server software. Since these servers are located all over the world, they are collectively known as a Distributed Database system (as opposed to a Centralized system.)
The DNS server databases contain entries that provide all the details about the domain (that is, the Second Level Domain -- "mydomain.com" in our example) such as how to handle email for the domain and where to find "hosts". Hosts are names for computer systems that are to be referred to within the domain by a name such as "host.mydomain.com". There can also be an entry for an alias, which is a name pointing to a host name that has been defined somewhere else (either within this domain or within another domain.) A very common use for one of these entries is to define "www" as either a host name or an alias pointing to the computer that is hosting the website for the domain.
There can also be a definition of another level domain within this domain, creating a third level domain. When this system was first devised, I am sure that the originators had a particular way of referring to the various levels of domains. That particular way may or may not be the same as the common convention today, and it really doesn't matter! You can think of them as First, Level, Second Level, Third Level (Fourth, etc.) but the common reference to them is as "Top Level Domain" or "TLD", "Domain" as in "Domain Name", and "Sub-Domain" (or "Subdomain".) (There it is, at last!) As I have implied here, it is possible to define a fourth level within the third, and so on. Though not so common, there are reasons why it may be useful to define multiple levels of subdomain within a domain, mostly related to convenience of organization of complex situations.
Each subdomain can contain definitions of hosts and aliases, as well as instructions for handling the subdomain's email. In fact, almost everything that can defined for a domain can also be defined for a subdomain (the only things that can't are way too technical for this piece!) A website defined within a subdomain might have an alias defined for its web host computer, giving its website the address "www.sub.mydomain.com". It would also be possible to provide a default pointer for "sub.mydomain.com" which points to the same computer so that "sub.mydomain.com" would also get to the same website.
It is important not to get confused between the definitions of subwebs and subdomains and to remember exactly what each one does, and does not. In a nutshell, subwebs are websites within FrontPage websites that are seen by FrontPage as separate websites, but are not defined on the web server as a separate site. Subdomains are names within Domain Name definitions that can be used to define another level of name pointers within the domain. Whether these names point to the same websites, different websites or different areas within the same websites as the parent domain, depends on what server computer(s) the subdomain and its hosts and aliases point to, and on the website definitions on those server computers.
The Domain Name System was designed to provide a great deal of flexibility. Along with that flexibility comes a degree of complexity that can make it a little confusing until you get used to it. I hope that this explanation will shed a little light on the subject for you!