Below is not recommended
- insert ignore into
- on duplicate key update
- replace into
- insert if not exists
Better use this one
It works in any cases and you don't have to change your data table structure.INSERT
INTO
dbo.Customer (firstname, lastname, phone)
SELECT
'Mitch'
,
'Valenta'
,
'555-867-5309'
WHERE
NOT
EXISTS
(
SELECT
firstname, lastname
FROM
dbo.Customer
WHERE
firstname =
'Mitch'
AND
lastname =
'Valenta'
)