default value - adding multiple records with and without default value
in SQL / DEFAULT Constraint
how can i add default value if i give condition like this for multiple records
insert into companies(company_id,company_name,headquarters_phone_number)
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)
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.
Submit an answer
Why did you not do not null, primary key and auto increment for customer id in the solution?