VMWare Inc Interview Question
Software Engineer / DevelopersYou could map the class hierarchy to a single db table using "discriminator" column (as in Hibernate for example).
create table team(
id bigserial primary key,
discriminator varchar(30), // FOOTBAL, BASEBALL etc.
footbal_scores int, // can't specify "not NULL" (just "not NULL default 0")
baseball_scores int ...
);
create table TEAM {
- Amol March 20, 2011id long,
name varchar,
designation varchar,
supervisor long refereces TEAM(id),
dept varchar,
primary key (id),
}