After testing this worked perfectly, but this would yield error in the future if there are changes to table structure, say, there are more columns added.
So, it is highly recommended to always add the columns of the table in the insertion SQL statement along with the values data.
For example:
Let's assume that we have data_table with the following structure.
DATA_TABLE
-------------------
ID | NUMBER |
NAME | TEXT |
LAST_NAME | TEXT |
This insertion SQL statement tend to create the problem in the future.
INSERT INTO DATA_TABLE VALUES(1, 'NAME 1', 'LAST NAME 1')This statement would be OK at first, but when the structure of the table changes by adding ADDRESS column; this will surely cause problem.
DATA_TABLE
-------------------
ID | NUMBER |
NAME | TEXT |
LAST_NAME | TEXT |
ADDRESS | TEXT |
If we have created the insertion statement as shown below in the beginning, the problem would not happen.
INSERT INTO DATA_TABLE(ID, NAME, LAST_NAME) VALUES(1, 'NAME 1', 'LAST NAME 1')
0 comments:
Post a Comment