Jak ustawic dzeidziczenie tabeli?

0

Chciałem dodać dziedzieczenie do tabelki która już istnieje i posiada rekordy. Czy mozna to jakoś zrobić czy trzeba zrobic zrzut tabeli , i stworzyc na nowo z zaznaczeniem dziedziczenia po innej tabeli ?

0

Nie ma czegoś takiego w relacyjnej bazie danych jak dziedziczenie po tabeli.

1

W PostgreSQL istnieje dziedzicznie. Jedna tabela może dziedziczyć pola po drugiej.

Co do pytania to polecam czytać dokumentację, która jest po prostu wyśmienitą lekturą dla każdego adepta tego silnika bazy danych. Jeżeli używasz wersji 9.0 to odpowiem cytując dokumentację:

Table inheritance is typically established when the child table is created, using the INHERITS clause of the CREATE TABLE statement. Alternatively, a table which is already defined in a compatible way can have a new parent relationship added, using the INHERIT variant of ALTER TABLE. To do this the new child table must already include columns with the same names and types as the columns of the parent. It must also include check constraints with the same names and check expressions as those of the parent.

http://www.postgresql.org/docs/9.0/static/ddl-inherit.html

1 użytkowników online, w tym zalogowanych: 0, gości: 1