Compact group (CG) is a kind of special galaxy system where the galaxy members are separated at the distances of the order of galaxy size. The strong interaction between the galaxy members makes CGs ideal labs for studying the environmental effects on galaxy evolution. Traditional photometric selection algorithm biases against the CG candidates at low redshifts, while spectroscopic identification technique is affected by the spectroscopic incompleteness of sample galaxies and typically biases against the high redshift candidates. In this study, we combine these two methods and select CGs in the main galaxy sample of the Sloan Digital Sky Survey, where we also have taken the advantages of the complementary redshift measurements from the LAMOST spectral and GAMA surveys. We have obtained the largest and most complete CG samples to date. Our samples include 6,144 CGs and 8,022 CG candidates, which are unique in the studies of the nature of the CGs and the evolution of the galaxies inside.