Examples of the Multiple-Column Constraint Format

The following example creates a standard table, called order_items, with a unique constraint, called items_constr, using the multiple-column constraint format:
CREATE TABLE order_items
   (
   order_id SERIAL,
   line_item_id INT not null,
   unit_price DECIMAL(6,2), 
   quantity INT, 
   UNIQUE (order_id,line_item_id) CONSTRAINT items_constr
   );

For constraint names, see Declaring a Constraint Name.