How can you prevent duplicate entries in a MySQL table?
Correct answer
A. Use the UNIQUE constraint on a column.
18 views
A. Use the UNIQUE constraint on a column.
18 views
Use the UNIQUE constraint on the column. MySQL will then reject any INSERT or UPDATE that would create a repeated value, enforcing the rule at database level.
An auto-increment primary key only makes the ID unique, NOT NULL only blocks empty values, and manual checking is slow and unreliable when several users write at once.
Want more practice? Try the full set of Database Management Systems MCQs on MCQsExam.com.
Not sure why the answer is A? Ask here and get an explanation.