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

  • Home
  • SEARCH
  • 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 5939715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:52:01+00:00 2026-05-22T15:52:01+00:00

I am building a database using SQL Server 2008 to store prices of securities

  • 0

I am building a database using SQL Server 2008 to store prices of securities that are traded on multiple markets.

For a given market, all the securities have the same holiday calendar. However, the holiday calendars are different from market to market.

I want the following four tables: Market, GoodBusinessDay, Security, and SecurityPriceHistory, and I want to enforce that SecurityPriceHistory does not have rows for business days when the market on which a security was traded was closed.

The fields in the tables are as follows:

Market: MarketID (PK), MarketName

GoodBusinessDay: MarketID (FK),
SettlementDate (the pair is the PK)

Security: SecurityID (PK), MarketID
(FK), SecurityName

SecurityPriceHistory: This is the
question – my preference is
SecurityID, SettlementDate,
SecurityPrice

How can I define the tables this way and guarantee that for every row in SecurityPriceHistory, there is a corresponding row in GoodBusinessDay?

If I added a column for MarketID to SecurityPriceHistory. I could see how I could do this with two foreign keys (one pointing back to Security and one pointing to GoodBusinessDay), but that doesn’t seem like the right way to do it.

  • 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-05-22T15:52:02+00:00Added an answer on May 22, 2026 at 3:52 pm

    This model should do. The relationship between Market and BusinessDay is identifying, that is, a businessday does not exist outside the context of the market to which it belongs.

    Similarly, the relationship between BusinessDay and SecurityPriceHistory is identifying, as it the relationship between Security and SecurityPriceHistory.

    This means that the primary key of SecurityPriceHistory is composite: security_id,market_id and settlement_date.

    take 1

    This will enforce the constraint that each security may be have no more than one row in SecurityPriceHistory for a given market/business day. It does, however, allow for the same security to trade in multiple markets, despite the security’s relationship to a particular market: to restrict that, the relationship between Market and Security needs to be identifying, thus:

    take 2

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

Sidebar

Related Questions

We are building a new application in .net 3.5 with SQL server database. The
SQL Server 2008 Ent ASP.NET MVC 2.0 Linq-to-SQL I am building a gaming site,
I'm building a wepage in php using MySQL as my database. Which way is
I have this legacy database for which I'm building a custom viewer using Linq
I am building an app that talks to an Access database via OleDB/Jet. There
I am building a web application that uses the database for Users, Security/roles, and
I'm building C# WinForms using the MVP pattern in VS 2008. I will migrate
I'm building a poll widget using ASP.NET controls and Linq-to-Sql for a high traffic
Situation I'm creating a C#/WPF 4 application using a SQL Compact Edition database as
I am building a system that allows for an entry into the database (think

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.