Actually, I don't know what is different the following query?
Which one is better(performance, etc...)? Btw, I use SQL Server.
Query 1 :
INSERT INTO PERSON (ID, NAME, ADDRESS) VALUES('001', 'Smit', 'London');
INSERT INTO PERSON (ID, NAME, ADDRESS) VALUES('002', 'Jhon', 'London');
Query 2 : I never saw before
INSERT INTO PERSON (ID, NAME, ADDRESS)
SELECT '001', 'Smit', 'London' UNION ALL
SELECT '002', 'Jhon', 'London'
How about the multi-row syntax with table value constructors :
INSERT INTO PERSON (ID, NAME, ADDRESS)
VALUES ('001', 'Smit', 'London'), ('002', 'Jhon', 'London');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.