Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL - Trouble running a script from an existing .sql file which should create a schema, its tables and insert all necessary data in Workbench
    primarykey
    data
    text
    <p>I have installed MySQL Workbench 6.0 and am trying to import a .sql file. The file should create a number of tables, insert data into each of these and commit these changes. It's a sample file for a course I'm doing and I'm going to use it to practice writing queries. Nothing fancy.</p> <p>I want to create a schema in Workbench, run this script and end up with a database containing these tables and all the data, however I'm having trouble doing so.</p> <p>I've tried creating a new schema and using the Forward Engineer... option and modifying the script myself, but I keep getting an error message that already exists.</p> <p>I'm a complete beginner with Workbench so I wouldn't be surprised if I'm going about this all wrong.</p> <p>Can anyone advise?</p> <p>EDIT:</p> <p>I'm now getting the error 1215: Cannot add foreign key constraint</p> <pre><code>create table Debiteur ( debiteurcode char(6) not null, naam varchar(30) not null, adres varchar(40) not null, postcode varchar(7) not null, plaats varchar(30) not null, land varchar(30) not null, telefoon varchar(12) not null, fax varchar(12), korting numeric(6,3), primary key (debiteurcode) ); create table Factuur ( factuurnummer integer not null, debiteurcode char(6) not null, besteldatum date not null, leverdatum date, factuurdatum date, bedrag numeric(8,2) not null, transportkosten numeric(8,2), betaaldatum date, primary key (factuurnummer), foreign key (debiteurcode) references Debiteur ); </code></pre> <p>The problem seems to be in the second table 'Factuur'.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload