This work aims to detect and classify stellar flares and potential stellar coronal mass ejection (CME) signatures in optical spectra provided by the Sloan Digital Sky Survey (SDSS) data release 14. The sample is constrained to all F, G, K, and M main-sequence type stars, resulting in more than 630,000 stars. This work makes use of the individual spectral exposures provided by the SDSS. An automatic flare search was performed by detecting significant amplitude changes in the $Halpha$ and $Hbeta$ spectral lines after a Gaussian profile was fit to the line core. CMEs were searched for by identifying asymmetries in the Balmer lines caused by the Doppler effect of plasma motions in the line of sight. We identified 281 flares on late-type stars (spectral types K3 to M9). We identified six possible CME candidates showing excess flux in Balmer line wings. Flare energies in $Halpha$ were calculated and masses of the CME candidates were estimated. The derived $Halpha$ flare energies range from $3 times 10^{28} - 2 times 10^{33}$ erg. The $Halpha$ flare energy increases with earlier types, while the fraction of flaring times increases with later types. Mass estimates for the CME candidates are in the range of $6 times 10^{16} - 6 times 10^{18}$ g, and the highest projected velocities are $sim300 - 700:$ km/s. The low detection rate of CMEs we obtained agrees with previous studies, suggesting that for late-type main-sequence stars the CME occurrence rate that can be detected with optical spectroscopy is low.