Source

EYuiDemo / protected / data / eyuirelation-demo.sql

Full commit
CREATE TABLE tbl_company (
    id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
    name VARCHAR(128) NOT NULL
);

CREATE TABLE tbl_job (
    id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	company_id INTEGER NOT NULL,
    name VARCHAR(128) NOT NULL
);

CREATE TABLE tbl_department (
    id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	company_id INTEGER NOT NULL,
    name VARCHAR(128) NOT NULL
);

INSERT INTO tbl_company (id,name) VALUES (1, 'software & designers co');
INSERT INTO tbl_company (id,name) VALUES (2, 'website masters co');

INSERT INTO tbl_job (company_id,name) VALUES (1, 'analist');
INSERT INTO tbl_job (company_id,name) VALUES (1, 'programmer');

INSERT INTO tbl_job (company_id,name) VALUES (2, 'template creator');
INSERT INTO tbl_job (company_id,name) VALUES (2, 'html designer');

INSERT INTO tbl_department (company_id,name) VALUES (1, 'administration');
INSERT INTO tbl_department (company_id,name) VALUES (1, 'programming');

INSERT INTO tbl_department (company_id,name) VALUES (2, 'reception');
INSERT INTO tbl_department (company_id,name) VALUES (2, 'graphics');

CREATE TABLE tbl_companyjob (
    id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	job_id INTEGER NOT NULL,
	company_id INTEGER NOT NULL
);

CREATE TABLE tbl_companydepartment (
    id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
	department_id INTEGER NOT NULL,
	company_id INTEGER NOT NULL
);