Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

SQL Import problem 09 Jan 2019 20:23 #15636

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;

Please Log in or Create an account to join the conversation.

SQL Import problem 09 Jan 2019 20:52 #15637

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.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.078 seconds

Although I found this tool some time ago I just started learning experimenting and building this first component on Monday and now on Thursday afternoon it's already online. Although I already had a working version done with another tool this is much easier to build and at the end you have the freedom to own your own component. Once you know how to use Cook you will boost your productivity as the learning curve is really moderate compared to many other tools.
Giori (Forum)

Get Started