View Single Post
Old 07-03-2020, 06:49 PM   #3
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,562
Karma: 79436716
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
One thing I think people forget is that there are two forms of SQL inserts.

Either
Code:
INSERT INTO Customers
VALUES ('Cardinal', 'Tom B. Erichsen', 'Skagen 21', 'Stavanger', '4006', 'Norway');
Or
Code:
INSERT INTO Customers (CustomerName, ContactName)
VALUES ('Cardinal', 'Tom B. Erichsen');
The second method explicitly names the columns being given data and sets the other columns to default values. This means that if the table is changed to have additional columns added the insert will still function.

For instance at one point all one needed was
Code:
INSERT INTO user (UserID, UserKey, UserDisplayName, UserEmail)
values("00000000-0000-0000-0000-000000000000","00000000-0000-0000-0000-000000000000","MyDummyUser@dummy.com","MyDummyUser@dummy.com")
If now additional columns need explicit values they just need to be added to both the list of columns and the value statement

Last edited by PeterT; 07-03-2020 at 06:54 PM.
PeterT is offline   Reply With Quote