-1

This my table:

customer_id
user_id
password
email
first_name
last_name

My primary key is customer_id which is generated by the system. How can I prevent a user form creating multiple accounts?

Should I put a constrain on another column?

Arulkumar
  • 12,966
  • 14
  • 47
  • 68
J Sam
  • 13
  • 1

2 Answers2

1

Create a unique index or constraint on however you identify the user. I'm not sure which columns you have in mind, but this would be typical:

alter table mytable add constraint unq_table_email unique (email);

You can have more than one unique constraint on the table.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
0

Here you don't have a username field so u can do is that you can make email field as unique. What I do is that I make email id unique and whenever user tries to register i check whether email id is present. Because email id is unique no two person can have same email id.

thedudecodes
  • 1,479
  • 1
  • 16
  • 37