Skip to content

Inserting Data Into a Table

Daniel Cortes edited this page Jul 29, 2024 · 4 revisions

It has to map up in this way:

If we swap country with population we would be wrong, so when we list out the column names, the VALUES has to go in with the same order.

We also do not need to write separate INSERT INTO we can do multiple rows like so:

INSERT INTO
  cities (name, country, population, area)
VALUES
  ('Delhi', 'India', 28125000, 2240),
  ('Shanghai', 'China', 22125000, 4015),
  ('Sao Paulo', 'Brazil', 20935000, 3043);
Clone this wiki locally