title: Patterns for storing grid-like data in a database
body: <p>We are attempting to build something akin to a very basic version of a spreadsheet or a database table. We have rows and columns, and we want the user to be able to add rows or columns, and do some basic sorting/filtering.</p>
  
  <p>One concept we've had was to simply create a new database table for every "document" that we want to store. This way, the SQL is simple and fast. However, this brings about a plethora of problems including managing the different tables per client, having to execute "ALTER TABLE" statements when they want to add a new column, and similar issues.</p>
  
  <p>So, what is the best way to store grid-like data with unknown columns in a single (or multiple) tables in a database such that sorting and filtering doesn't become a nightmare?</p>