I want to build some tables, with somthing weird for me. I was searching on psql manual and don't found nothing.
Is it posible to have a tables inside a table on postgresql? What i want to do is to have a table (named users) a tables with user info, and inside this table in some point to all the cars this user could have. This cars are on other table outside user table. Users could own this cars, with posibiliies of some customization, i need to save this customs cars in somewhere. I wander if i could have a table inside user table, that will grow with any problem, or some other solution like that.
I think others ways to do it, like table outside user table, a string with parsers, but now i want to do if this is possible.
The "traditional" way to do this is to have a table of users, a table of cars, and a 1:M linking table between them. If you want to include the cars within the users table, perhaps the Array Type in PostgreSQL could work.
I'll try to explain. Usually, a situation like yours is done with three tables. One contains information about each person. Another contains information about each car. A person can own more than one car, so a third table is needed to link the person to the cars he or she owns. Doing it this way, a person can own any number of cars. You asked about a table-within-a-table. This is usually not supported by database programs. However, PostgreSQL is a very powerful program and supports an Array type. Thus, you can store an array of informaiton in one column of a table. This is kind of like a table-within-a-table.
This sort of table is usually called an intersection table, and is the standard way to represent a many-to-many relationship in a relational database.
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert