0

Is it possible to create tables based on a columns data?

I currently have a table named Exchange which contains numerous columns

ID:NAME:PRICE
1:Stick:12
2:Stone:20
3:Water:1
4:Water:1

But I want to create numerous tables based on the Name column and select the rows that contain that name and move them to their respective table.

So in the above example, the result would be 3 new tables

Stick, Stone & Water

The table Water would be

1:Water:1
2:Water:1
2
  • Don't do it. But if you really must head down this route have you considered views instead of tables? Commented Feb 25, 2023 at 15:32
  • This is really an SQL issue and nothing to do with UNIX&Linux Commented Feb 25, 2023 at 17:05

1 Answer 1

1

Do not do it. It is extremely bad idea to create numerous tables.

Better learn EAV model (which is already in use in your Exchange table): https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .