When talking about domains there are three distinct types of domains, your main domain , a subdomain and a subdirectory or sometimes referred to as a (sub folder) and there are many notable differences between the three types of domains.
The structure of the three domains can be clearly seen in the structure of the url that is created from the domains the main domain is the one purchased from your hosting provider or thired party domain register and looks like www.createawebsite.online.
The subdomain, which is setup in your cpanal or control panal is structured from the main domain say you need to add a forum to the website the subdomain url will look like www.forums.createawebsite.online and can be run as a separate domain or a subdomain depending on the document root chosen when setting up the domain.
The sub directory or sub folder is set up in your public html of your main domain, in the public html folder you simply create a new folder named forums in this folder you upload your content management system like Wordpress or Joomla the website then can be accessed by typing in your main domain plus the folder name which looks like www.createawebsite.online/forums
There is debate on which type of domain is better suited for search engine optimization and Google rankings, according to Google both the subdomain and subdirectory have equal ranking power the main difference between the two comes down to the root domain and keywords.
The subdomain is treated as a separate website from the main domain so the keywords used in the subdomain are treated separately than the keywords in the main domain effectively giving two separate rankings the authority gained from the main name is lost with the subdomain, the subdirectory keywords are not treated as separate from the main domain so all the authority comes from the main domain which can be seen as a better option for search engine optimization.
A subdomain would best suit a website like a large company that needs to expand globally into different countries where the languages are different, each subdomain would be setup for each countries language with new keywords directed at that country.
A subdirectory would best suit a personal or business website looking to rank well in there own country not offshore, say you need to add a forum or an online store to your main website, the subdirectory will gain all the authority from the main website effectively giving the subdirectory equal ranking of the main website.