UNIQUE Constraint
A unique constraint is essentially the same as creating a unique index, because when a unique constraint is created, the system creates a unique index that implements the constraint through a unique index. However, the unique constraint more intuitively expresses the uniqueness of the corresponding column, making the purpose of the corresponding index clearer, so it is generally recommended to create a unique constraint instead of just creating a unique index.
The operation to create a unique constraint in PD, in the classroom table, Roomid is the primary key, must be unique, roomname if we are going to have to be unique, then the specific operation is as follows:
In the model design panel of PD, double-click the Classroom table, open the Properties window, switch to the Keys tab, and see a row of data pk_classroom, which is a primary key constraint. Add a row of data, named Uq_roomname, you cannot select the "P" column on the right, then click the toolbar's Properties button, pop up the uq_roomname Properties window, switch to the Columns tab, click the Add Column button, choose to add the Roomname column to it, Then click OK to complete the addition of the unique constraint.