The linear and nonlinear optical responses in a large number of cubic insulators are studied by means of first-principles local-density calculations. Complete results on band structures, frequency-dependent dielectric functions, and frequency-dependent third-order nonlinear susceptibilities ${\mathrm{\ensuremath{\chi}}}^{(3)}$(\ensuremath{\omega}) (in the simplest form as the third-harmonic generations) are presented for 27 alkali halides, alkali-earth fluorides, oxides, and sulfides. They are LiF, LiCl, LiBr, LiI, NaF, NaCl, NaBr, NaI, KF, KCl, KBr, KI, RbF, RbCl, RbBr, RbI, ${\mathrm{CaF}}_{2}$, ${\mathrm{SrF}}_{2}$, ${\mathrm{CdF}}_{2}$, ${\mathrm{BaF}}_{2}$, MgO, CaO, SrO, BaO, MgS, CaS, and SrS. The results are compared with the existing experimental data and other calculations. The effectiveness of using a ``scissor operator'' to correct the gap underestimation in the local-density-approximation theory is assessed. It is shown that the full band-structure approach for the ${\mathrm{\ensuremath{\chi}}}^{(3)}$(0) calculation in these crystals gives results in very good agreement with experimental data, especially in the anisotropic coefficient of the nonvanishing tensor elements.