Hi Admin and everyone on the forum!
Is anyone using SQL import? I would need this function for school but it doesn't work for me as expected. I try to put the file *.sql in the box and it is not working. Nothing happens. I try it give or take 100 times and I get lucky 2 times..but I try to import also foreign key and It was not working.
I have created ERD diagram and then export schema script (sql file) and now I am trying to import this file. Problem is that import function is not working and I don't know how to properly import foreign keys...
What am I doing wrong? Please help.
Here is my sql file code:
CREATE SCHEMA mytest;
CREATE TABLE mytest.country (
id bigint UNSIGNED NOT NULL AUTO_INCREMENT,
country char(100) NOT NULL ,
CONSTRAINT pk_country_id PRIMARY KEY ( id ),
CONSTRAINT unq_country_country UNIQUE ( country )
) engine=InnoDB;
CREATE TABLE mytest.street_number (
id bigint UNSIGNED NOT NULL AUTO_INCREMENT,
street_number char(20) NOT NULL ,
CONSTRAINT pk_street_number_id PRIMARY KEY ( id ),
CONSTRAINT unq_street_number_street_number UNIQUE ( street_number )
) engine=InnoDB;
CREATE TABLE mytest.street (
id bigint UNSIGNED NOT NULL AUTO_INCREMENT,
street char(150) NOT NULL ,
CONSTRAINT pk_ulice_id PRIMARY KEY ( id ),
CONSTRAINT unq_street_street UNIQUE ( street )
) engine=InnoDB;
CREATE TABLE mytest.address (
id bigint UNSIGNED NOT NULL AUTO_INCREMENT,
street_number char(20) ,
country char(100) ,
street char(150) ,
CONSTRAINT pk_address_id PRIMARY KEY ( id ),
CONSTRAINT fk_address_street FOREIGN KEY ( street ) REFERENCES mytest.street( street ) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_address_street_number FOREIGN KEY ( street_number ) REFERENCES mytest.street_number( street_number ) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT fk_address_country FOREIGN KEY ( country ) REFERENCES mytest.country( country ) ON DELETE NO ACTION ON UPDATE NO ACTION
) engine=InnoDB;