Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Insert data into table except one column SQL

I just want to know if it is possible to insert data into a table that has columns for example ID, FIRST_NAME, AGE, SEX, SALARY but I want to insert into all columns except the column id.

Normally as I know I need to set this code

INSERT_INTO TABLE_NAME (FIRST_NAME, AGE, SEX, SALARY) 
VALUES (....);

but it will take a long time if there is a lot of columns…

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Is there any code that will grant me time?

>Solution :

you can pass null value for the columns you don’t want to set.

Entry will be inserted with the default value if provided in the schema, or null is field is nullable

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading