Aldehydes and ketones can be prepared by a variety of methods. All of these and the corresponding mechanisms have already been covered previously, so if you need more details about the given reaction, just follow the link to open it in a separate article.
One of the most important ways of preparing aldehydes and ketones is the oxidation of primary and secondary alcohols respectively:

Remember that mild oxidizing agents such as PCC, DMP, and Swern are needed for oxidizing primary alcohols to aldehydes otherwise carboxylic acid are formed.
The reduction of certain carbonyl compounds by mild reducing agents such DIBAL can also be used for preparing aldehydes:

Although aldehydes and ketones are the most commonly used in the reactions with organometallics, Grignard reaction can be used for preparing ketones from nitriles and acid chlorides can produce ketones by reacting with organocuprates:

The Friedel-Crafts acylation of aromatic compounds is another possibility for synthesizing ketones:

Aldehydes and ketones can also be prepared by ozonolysis of alkenes:

Another method for preparing aldehydes and ketones is the hydration of alkynes. There are three main reactions for the hydration of alkynes: 1) Acid-Catalyzed Hydration, 2) Oxymercuration-Demercuration, and 3) Hydroboration-Oxidation.
The first two are used for Markovnikov conversion of terminal alkynes to ketones, whereas the hydroboration-oxidation is used for anti-Markovnikov carbonylation of alkynes where the final product is an aldehyde:



