Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7860383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:15:57+00:00 2026-06-02T22:15:57+00:00

A simple equity database has 3 tables: a ticker table, an exchange table, and

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:15:59+00:00Added an answer on June 2, 2026 at 10:15 pm

    I don’t think it’s possible to specify this constraint in MySQL, but you could use triggers to check that such combinations don’t already exist (raising an error if they do); note however that you’d need to have triggers before insert on the ticker table and before update on all three tables.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Simple question (I hope): I have a simple two column table, a measurement and
Simple question: When the compiler faces a call to, say, pow() with two constants
Simple question: How can I return the field type of a MySQL table. I
Simple question: I use Sequel Pro to connect to my database in the cloud.
Simple ASP.NET application. I have two drop-down controls. On the first-drop down I have
Simple question, how do you list the primary key of a table with T-SQL?
Simple question - In c++, what's the neatest way of getting which of two
Simple table: start_date TIMESTAMP duration_days INT In English: I simply want the rows which
Simple example of toggling between two states: if (this.lblColorChange.BackColor == Color.Red) { this.lblColorChange.BackColor =
Simple question here: is there any way to convert from a jagged array to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.