Unique Indexes
Learn to create unique indexes.
We'll cover the following...
Show existing customers
First, let’s see the current customers
table again.
Press + to interact
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
).
Press + to interact
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 ...
Access this course and 1400+ top-rated courses and projects.