To do the same please follow the steps.
Sub domain is part of the domain, it's like subletting a room of an apartment.
A records has to be setup on the dns.
For example :
mydomain.com has IP 18.104.22.168.0 and hosted with some other company.
Now to get the sub domain
of which the site is actually on another server then to create a sub domain
Login to your domain manager
And go to dns manager and add an A record in domain manager like this
anothersite.mydomain.com and point the IP to the other server 127.0.0.1
And that's it.
Wait for the DNS propogation usually happens instantly give it a time to reflect and point the sub domain name anothersite.mydomain.com and you are all set to go now as your sub domain points to Digital Ocean.