Database table for 2-dimensional array

My Doppler Value Investing site (http://www.dopplervalueinvesting.com) uses Ruby on Rails and a Postgres database.

There are two important parts: the superficial analysis and an in-depth analysis.

An example of the superficial analysis is at: http://www.dopplervalueinvesting.com/stocks/FAST

An example of the in-depth analysis is at:

Note that the results of the superficial analysis are 1-dimensional - just parameters. This easily fits into one row in one table of a database.

Note that the results of the in-depth analysis are 2-dimensional - parameters AND year. How would this fit into a Postgres database? What are your suggestions? Is it possible to have a table within a table?

Split it into multiple tables with associations between them (has_many, belongs to). Conceptually that can be likened to tables within tables. Have one table for each type of data.

Colin

Jason Hsu, Android developer wrote in post #1118601:

An example of the in-depth analysis is at: http://old.doppler.webfactional.com/sites/default/files/stock-results/FAST.html

Note that the results of the in-depth analysis are 2-dimensional - parameters AND year. How would this fit into a Postgres database? What are your suggestions? Is it possible to have a table within a table?

Technically speaking database tables are 2-dimensional. They have columns and rows. It just happens to be that the "columns" dimension is fixed and the "rows" is variable.

If you take your "Per Share Values" table that's actually what you see. The real issue is that you have decided to present the table transposed. You have a fixed number of rows and possibly a variable number of columns (years).

The data itself could be represented using a single table: