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.
↳
companiesis ahistorical (+)blockchain used to keep track of company metadata.↳
pricingis asparseblockchain 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 trackerbuilt onsymbolandpriceto track company specific price changes.
COMPANIES SCHEMA:
Column 1: Primary key
symbolstored as a packed string.Column 2:
namerepresents the company name stored as a packed string.Column 3:
sectoris 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
symbolstored as a packed string. - Column 2:
pricerepresents the current stock price and is stored as a float32. - Column 3:
dividend_yieldrepresents dividends as a percentage of current share price and is stored as a float32. - Column 4:
price_earningrepresents price to earning ratio and is stored as a float32. - Column 5:
earningsrepresents the companies profit per outstanding share of stock stored as a float32. - Column 6:
book_valuerepresents the difference between a companies total assets and its liabilities stored as a float32. - Column 7:
52_week_lowrepresents the lowest price the stock has reached in the last 52 weeks stored as a float32 and has an attachedCHECKconstraint that enforces [52_week_high > 52_week_low]. - Column 8:
52_week_highrepresents 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.
↳
analyticshas read and amend permissions on the financial blockchain and is owned by theadminrole.↳
writerhas write permissions on the financial blockchain and is owned by theadminrole.