I'm using MySQL Workbench to design a new schema and I have an exisiting create statement for a new table. Is it possible to use the create statement to create the table instead of manually writing out all the columns and types?
For example, here is my SQL:
CREATE TABLE IF NOT EXISTS `mydb`.`user` (
`user_id` INT UNSIGNED NOT NULL,
`last_updated` DATETIME NOT NULL DEFAULT now(),
`user_stamp` INT UNSIGNED NOT NULL DEFAULT 1,
`user_name` VARCHAR(15) NOT NULL,
`company_code` INT UNSIGNED NOT NULL,
`email` VARCHAR(50) NULL DEFAULT '',
`active` CHAR(1) NULL DEFAULT 'Y',
`first_name` VARCHAR(20) NULL,
`last_name` VARCHAR(20) NULL,
PRIMARY KEY (`user_id`),
INDEX `fk__user__company_idx` (`company_code` ASC),
CONSTRAINT `fk__user__company`
FOREIGN KEY (`company_code`)
REFERENCES `mydb`.`company` (`company_code`)
ON DELETE CASCADE
ON UPDATE NO ACTION
);
I want to be able to run this statement somewhere in MySQL Workbench so the table gets added to my schema and then I use it in my diagram.