A simple equity database has 3 tables: a ticker table, an exchange table, and a currency table. The ticker table has two columns: a symbol column (ex: IBM), and a foreign key to a row in the exchange table. The exchange table has two columns: a name column (ex: NYSE), and a foreign key to a row in the currency table. The currency table has one column: a symbol (ex: USD). (I've left out the primary keys column for each table).
How do I enforce a constraint that there should not be the same ticker symbol twice for the same currency? i.e., I only want to allow one (IBM + USD). It is not enough to create a unique constraint on (ticker.symbol + ticker.exchange); (IBM + NASDAQ) is invalid if there is already (IBM + NYSE). I thought I could create a view that joined the ticker table and the currency table and create a unique index on (view.ticker + view.currency); however, as far as I can now tell, one cannot create an index on a view.