Reputation: 160
I have a table table1
(id
integer, Name
varchar, Age
integer)
While inserting rows into the table I use two statements.
INSERT INTO TABLE1('1','John','33');
and INSERT INTO TABLE1(1,'John',33)
;Both of them work fine. In the first insert
statement I have used the value between single quote for the integer datatype as well.
Can I know what can be the difference between both of the statements?
Upvotes: 4
Views: 37116
Reputation: 4639
There is no difference between using single quote for Integer datatype or not.
In first case it will load db server to convert your string literal to integer data type whereas in second case it will directly store integer value to database.
Its good to used without single quote, since that would just be an extra unnecessary step for the database to convert the string literal into a numeric value and also make some little bit difference in performance when there are more records inserted at a time.
Upvotes: 7