default value - adding multiple records with and without default value
how can i add default value if i give condition like this for multiple records
eg:
insert into companies(company_id,company_name,headquarters_phone_number)
values
('lan','cd','xyz'),
('chan', ,'abcd')
;
it showing error i want default values for 2nd record and 1st one with value inserted
i have added this condition also
alter table companies
change column company_name company_name varchar(255) default 'x';
1 answers ( 0 marked as helpful)
Tsvetelin Tsonkov
Instructor
Hi Lanchan!
Thanks for reaching out.
You need to use the ALTER TABLE
statement to add default values for the first and third column. If you provide a company name, you do not need to change this column to a default string. You simply provide a name and the other two columns contain a default value.
Hope this helps.
Best,
Tsvetelin