Here is my table game
:
create table game (
h_team number,
a_team number,
p_date date
);
Condition to be followed: Every team plays a single game on a particular date. Basically normal rules that usually should happen for a tournament.
I have added following constraints:
I want to add another constraints which restricts to add what the following queries performs:
select h_team, p_date
from game
where (h_team,p_date) not in (select a_team,p_date from game);
select a_team, p_date
from game
where (a_team,p_date) not in (select h_team,p_date from game);
For example,Suppose a record in that table is (1,2,23-JAN-2000). So records like (3,1,23-JAN-2000), (2,4,23-JAN-2000) etc. cannot be inserted. Thanks!
I preferred in SQl but it seems it is not possible in SQL. So How will it be using PL-SQL.