Jacob Uden

Generate statements (ddl) to create all objects

Excerpt from the complete ddl: http://sqlfiddle.com/#!9/2047e0

  • October 6, 2016 at 3:41 PM
  • Visible to public
CREATE TABLE food

name VARCHAR(12) NOT NULL,  quantity INT NOT NULL,  PRIMARY KEY (name)
);

CREATE TABLE species

name VARCHAR(12) NOT NULL,  location VARCHAR(12) NOT NULL, diet VARCHAR(12) NOT NULL,  PRIMARY KEY (name),  FOREIGN KEY (diet) REFERENCES food(name)
);

CREATE TABLE pets

name VARCHAR(12) NOT NULL,  sex VARCHAR(1) NOT NULL,  species VARCHAR(12) NOT NULL,  color VARCHAR(8) NOT NULL,  PRIMARY KEY (name),  FOREIGN KEY (species) REFERENCES species(name));