Its all done with Code, lots of it. (well, it should be lots if its done properly).
basically, you would use a server side language (such as PHP), and a database (such as MySQL), and then you would create a few tables to store your data, and then use PHP to interact with it, such as inserting rows, extracting data etc.
My guess is you havn't used PHP before, in which case i would strongly recommend you hire somone to do this for you, as you would have numerous securty issues that need to be addressed, and as you are dealing with money (you said ordering from the database), I really would recomment hiring someone, or using a pre-built site, and use a template.
You could use Joomla or Drupal, and use some E-commerce plugins to get a small shop up and running.