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 ahistorical (+)
blockchain used to keep track of company metadata.↳
pricing
is asparse
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 calledprice tracker
built onsymbol
andprice
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 attachedCHECK
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 theadmin
role.↳
writer
has write permissions on the financial blockchain and is owned by theadmin
role.