Insert to table on conditions

时间:2017-04-13 14:55:30

标签: sql node.js database

How can I check my database if the email is already registered to throw an error else proceed to insert to table the new account this is what i got

IF Not Exists(
  SELECT EmailAddres FROM accountInfo WHERE accountInfo.EmailAddres = $3
)
BEGIN
INSERT INTO accountInfo (FirstName, LastName, EmailAddres,Password)
VALUES($1,$2,$3,$4)

0 个答案:

没有答案