Skip to content
Advertisement

Tag: unique-constraint

How do I make sure that all rows with the same foreign key have unique names in my PostgreSQL database?

I have a PostgreSQL database with two tables: Team and Project, in a one-to-many relationship. Team has these columns: id name Project has these: id name team_id I’d like to make sure that the projects within a team must have unique names. Projects belonging to different teams should be able to share names without a problem, so UNIQUE doesn’t really

Unique value Constraint with multiple columns across the table, not the combination in Oracle

In oracle is there a way to enforce uniqueness among two columns? Its not the uniqueness among combination of two columns, but values across table among two columns. References: Unique value constraint across multiple columns Example data, which should not be allowed: Unique constraint on combination of two columns? My Oracle Version: Answer I would use a check() constraint to

Advertisement