Hubert-Dudek
Databricks MVP

All is ok (although I don't like that behavior with INSERT SELECT 😉 )

  • you need to specify NULL values for all missing fields:
Create or Replace table MMR_Restated 
(
BID Varchar(20),
YearMo long,
Member_cnt integer);
 
INSERT INTO MMR_Restated
Select "AAA", 111, NULL;
  • one trick which I know is to provide auto generated column (which is expression) so then it can be skipped (problem is that it is constraint so when you insert something not matching that expression insert will fail):
Create or Replace table MMR_Restated 
(
BID Varchar(20),
YearMo long,
Member_cnt integer GENERATED ALWAYS AS (0));
 
INSERT INTO MMR_Restated
(BID, YearMo)
Select "AAA", 111;


My blog: https://databrickster.medium.com/