Skip to main content

Demo Database

financial is a sample database that showcases database design using bSQL features, tools and best practices. The database downloads and samples are in the bSQL samples GitHub repository.

A Quick Look

  • The financial database contains two blockchains.

    companies is a historical (+) blockchain used to keep track of company metadata.

    pricing is a sparse blockchain used to keep track of company statistics and takes advantage of the sparse index to minimize storage while tracking updates. There is an ALT3 index called price tracker built on symbol and price to track company specific price changes.

COMPANIES SCHEMA:

  • Column 1: Primary key symbol stored as a packed string.

  • Column 2: name represents the company name stored as a packed string.

  • Column 3: sector is the name of the industry in which this company operates and is stored as a packed string and defaults to "Undefined" if no value is specified.

PRICING SCHEMA:

  • Column 1: Primary key symbol stored as a packed string.
  • Column 2: price represents the current stock price and is stored as a float32.
  • Column 3: dividend_yield represents dividends as a percentage of current share price and is stored as a float32.
  • Column 4: price_earning represents price to earning ratio and is stored as a float32.
  • Column 5: earnings represents the companies profit per outstanding share of stock stored as a float32.
  • Column 6: book_value represents the difference between a companies total assets and its liabilities stored as a float32.
  • Column 7: 52_week_low represents the lowest price the stock has reached in the last 52 weeks stored as a float32 and has an attached CHECK constraint that enforces [52_week_high > 52_week_low].
  • Column 8: 52_week_high represents the highest price the stock has reached in the last 52 weeks stored as a float32.

Permissions

  • The financial database has two additional database roles.

    analytics has read and amend permissions on the financial blockchain and is owned by the admin role.

    writer has write permissions on the financial blockchain and is owned by the admin role.