A RAW image file has all the pixel data the image sensor recorded and has no post processing applied in the camera before the data is written to the memory card. All digital cameras record an image initially as analog information that is then processed in a analog-to-digital converter (A-D converter). The A-D converter outputs a RAW data file. A RAW image file can be saved over and over again with no loss of data. RAW data typically have a 16-bit color depth.
Raw data files cannot be viewed as an image. They have to be converted to some other format. As it stands now each camera manufacturer has their own proprietary format. For Nikon it is .NEF. For Canon it is .CR2.
JPEG is a lossy, compressed output image format having only an 8-bit color depth. In other words, the RAW data from the sensor is made a much smaller file by throwing away 2/3 to 3/4 of the pixel data the image sensor initially captured as a RAW data file. Then, the image is post processed in the camera before it is written to the memory card before it is displayed on the cameras LCD screen. How much in camera post processing can be controlled to a certain extent by selecting different camera menu settings for saturation, sharpening, contrast, etc. however the camera manufacturer has set a minimum amount of post processing that can't be changed by the user.
Each time a JPEG is saved, some amount of the pixel data is discarded through file compression, eventually leading to a readily noticable degradation of the image quality, also known as JPEG artifacts.