Welcome, Guest
Username: Password: Remember me

TOPIC: SQL Import problem

SQL Import problem 09 Jan 2019 20:23 #15636

  • gremonasplet
  • gremonasplet's Avatar
  • Offline
  • New Member
  • Posts: 15
  • Thank you received: 1
  • Karma: 1
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;
The administrator has disabled public write access.

SQL Import problem 09 Jan 2019 20:52 #15637

  • gremonasplet
  • gremonasplet's Avatar
  • Offline
  • New Member
  • Posts: 15
  • Thank you received: 1
  • Karma: 1
Ockey...I switch from Firefox to Chrome.
There is also a problem with import. But now I need 20 times or more to drag file for import and then it is working.

I have look in the 1.0.sql file (from Admin com_hellomyworld) and I now I understand where I have done wrong (plural and singular)
I modify my sql script and now I foreign key is working.
The administrator has disabled public write access.
Time to create page: 0.174 seconds

Get Started