Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE IF NOT EXISTS `election` (
- `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
- `type` VARCHAR(5) NULL,
- `voter_id` INT UNSIGNED NULL,
- `candidate_id` INT UNSIGNED NULL,
- `time` VARCHAR(45) NULL,
- PRIMARY KEY (`id`),
- INDEX `candidate_id` (`candidate_id` ASC),
- CONSTRAINT `fk_election_candidate`
- FOREIGN KEY (`candidate_id`)
- REFERENCES `candidates` (`id`)
- ON DELETE NO ACTION
- ON UPDATE NO ACTION)
- ENGINE = InnoDB;
- -- -----------------------------------------------------
- -- Table `users`
- -- -----------------------------------------------------
- CREATE TABLE IF NOT EXISTS `users` (
- `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
- `username` VARCHAR(45) NOT NULL,
- `password` VARCHAR(65) NOT NULL,
- `name` VARCHAR(75) NULL,
- `gender` CHAR(1) NOT NULL DEFAULT 'M',
- `position` VARCHAR(45) NULL,
- `email` VARCHAR(100) NULL,
- `phone` VARCHAR(15) NULL,
- `active` CHAR(1) NOT NULL,
- `photo` VARCHAR(100) NULL,
- PRIMARY KEY (`id`),
- UNIQUE INDEX `username_UNIQUE` (`username` ASC))
- ENGINE = InnoDB;
- -- -----------------------------------------------------
- -- Table `teachers`
- -- -----------------------------------------------------
- CREATE TABLE IF NOT EXISTS `teachers` (
- `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
- `username` VARCHAR(45) NOT NULL,
- `password` VARCHAR(65) NOT NULL,
- `name` VARCHAR(75) NULL,
- `gender` CHAR(1) NOT NULL DEFAULT 'M',
- `pob` VARCHAR(45) NULL,
- `dob` DATE NULL,
- `teach` VARCHAR(50) NULL,
- `email` VARCHAR(100) NULL,
- `phone` VARCHAR(15) NULL,
- `active` CHAR(1) NOT NULL,
- `candidate_id` INT UNSIGNED NULL,
- `photo` VARCHAR(100) NULL,
- PRIMARY KEY (`id`),
- UNIQUE INDEX `username_UNIQUE` (`username` ASC),
- INDEX `candidate_id` (`candidate_id` ASC),
- CONSTRAINT `fk_teachers_candidates`
- FOREIGN KEY (`candidate_id`)
- REFERENCES `candidates` (`id`)
- ON DELETE CASCADE
- ON UPDATE CASCADE)
- ENGINE = InnoDB;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement