- Forums
- MYSQL
- How To Make Mysql Field Unique
Webune Will Show You How To Make Mysql Table Unique Using A Mysql Database Table Db [2306], Last Updated: Mon Jun 24, 2024
Webune Tutorials
Fri Oct 16, 2009
0 Comments
443 Visits
Welcome to Webune Forums.
one question we get often is how can you make a MySQL table field unique. meaning, you dont want to be the same and you want to not others to be the same. this is very usefule because you dont want to have the same field repeat again because sometimes, it can create confusion in your scripts.
Today we are going to try to help you with a simple step by step tutorial on how you can make it so that its only one value in a table and it is not repeated.
well, you can do this in your MySQL databases. for example. lets say i want to make a field called username in my users table.
PHP CODE
$sql = "ALTER TABLE 'users' ADD UNIQUE ('usersname')";