Search code examples
mysqlsqlinstances

create new instances for tables in mySQL


So I might be thinking of this the wrong way but I have a database with tables that are somewhat dependent on one another. In Java you can create new instances of the same class in order to do different things. Is there something to this effect in SQL?

Edit: For clarity

So My database is for an airplane reservation system. Each plane in the system has a set of seats with passengers on them, so I was thinking that instead of making a new table for each passenger manifest(i.e. passenger manifest 1, passenger manifest 2 etc...) I would make one table as a kind of template for each airplane. This is pretty easily done in Java with something like

Foo foo = new Foo(Stuff stuff);
Foo foo2 = new Foo(Stuff different stuff);

So I was wondering if there was something similar in SQL.


Solution

  • Databases, as opposed to JAVA, are aimed to host/store NON-VOLATILE information. As such, the basic concept you are proposing is completely outside the scope of databases (i.e. create new instances). Moreover, when you want to create a booking list for a new flight, you want to retain the information for a long time (much more than what you would with JAVA instances).

    You may think, however, of a booking table that includes a flight number and date as key (because flight number can be repeated, but not the same day). The rest of the information seats and occupants would depend on how you wish to organize your information (mainly, how and what you would be retrieving).