An upper endoscopy (EGD) is designed to examine the lining of the upper part of the digestive tract. This includes the esophagus, stomach, and the first portion of the small intestine. Beforehand, patients are given medicine to help relax. Using a thin, flexible tube tipped with a light, the doctor views the images on a video monitor. This procedure is often performed to obtain a biopsy; determine the cause of persistent abdominal pain, nausea, vomiting, difficulty swallowing, and bleeding; detect inflammation, ulcers, and tumors; and treat conditions.