The VALUES clause or building tables out of nothing


 

The VALUES clause is probably one of the most misused features in SQL. If you look at SQL forums online, you’ll see people use it as the second clause in an insertion statement, but they only use it to construct a single row at a time, thus:

BEGIN INSERT INTO Zodiac (astro_sign, astro_start_date, astro_end_date) VALUES (‘Aries’, ‘2022-03-21’, ‘2022-04-19’); INSERT INTO Zodiac (astro_sign, astro_start_date, astro_end_date) VALUES (‘Taurus’, ‘2022-04-20’, ‘2022-05-20’); … INSERT INTO Zodiac (astro_sign, astro_start_date, astro_end_date) VALUES (‘Pisces’, ‘2023-02-19’, ‘2023-03-20’); END;

Each insertion statement ends with a semi-colon, so they will be executed separately and in the order presented. An optimizer