Unique Indexes
Learn to create unique indexes.
We'll cover the following...
We'll cover the following...
Show existing customers
First, let’s see the current customers table again.
MySQL
select * from customers;
Now, let’s execute the following command. This will try to create a new customer, John Boo, but with the identity value equal to the identity of an existing customer (that of John Woo).
MySQL
insert into customers(name, identity) values ('John Boo','JW0001');
We’re doing a business error on purpose here. We’ve inserted the new customer with the wrong identity. However, the query has been successfully executed, and the new customer has ...