Newbie trying to figure out how to organize my table.

Dynamically adding columns is a bad idea but it looks like you've figured that out already. Pivot tables are a spreadsheet thing, for SQL what you're looking for is an association table or an intersection table. Essentially, you're looking for a one-to-many relationship.

For an association table you could create an outputs table and an inputs table (or just one inputs/outputs table depending on your use case). Each table should have a foreign key reference to the equipment table. Then you will use a join to query the tables.

However, if the inputs/outputs are standardized and don't change often (which it seems like they are in this case) you could use an intersection table. This requires 2 additional tables. You'd have a table with all possible inputs/outputs and the intersection table itself. The intersection table consists of 2 foreign keys, one to the equipment and one to the input/output. Again, you'd use a join to query.

Hopefully this helps you, let me know if you have any questions.

/r/SQLServer Thread