Well, sugar is NOT just one molecule. Sugar is the generalized name for sweet, short-chain, soluble carbohydrates, many of which are used in food. They are carbohydrates, composed of carbon, hydrogen, and oxygen. There are various types of sugar derived from different sources.
Simple sugars are called monosaccharides and include glucose, fructose, galactose,… The table or granulated sugar most customarily used as food is sucrose, a disaccharide. Other disaccharides include maltose and lactose. Longer chains of sugars are called oligosaccharides and polysaccarides. Chemically-different substances may also have a sweet taste, but are not classified as sugars.
Many people think of sucrose when they are talking about sugar. Sucrose is ##C_12H_22O_11##