##################### NAPLNENI DATABASE testcreator ##########################
#jednodussi verze

#nesmi byt v souboru dva stejne prikazy nad stejnou tabulkou ale s jinyma hodnotama
##############################################################################
######################## tableDatabase ##############################
##############################################################################

DELETE FROM `testcreator`.`table1`;
DELETE FROM `testcreator`.`table2`;
DELETE FROM `testcreator`.`table3`;
DELETE FROM `testcreator`.`table1hastable2`;

ALTER TABLE table1 AUTO_INCREMENT = 1;
ALTER TABLE table2 AUTO_INCREMENT = 1;
ALTER TABLE table3 AUTO_INCREMENT = 1;

# prvni naplnena tabulka musi byt table3
insert into table3(id_table3, table3_column1, table3_column2, table3_column3) VALUE
(null,'column11',1,'column31'),
(null,'column12',2,'column32'),
(null,'column13',3,'column33');

insert into table2(id_table2, table2_column1, table2_column2, table2_column3) VALUE
(null,'column11',1,'column31'),
(null,'column12',2,'column32'),
(null,'column13',3,'column33');

insert into table1(id_table1, table1_column1, table1_column2, table1_column3, table3_id_table3) VALUE
(null,'column11',1, 'column31',
  (
    select
    id_table3
    from
    table3
    where
    table3.table3_column1 = 'column11'
  )
),
(null,'column12',2, 'column32',
  (
    select
    table3.id_table3
    from
    table3
    where
    table3.table3_column1 = 'column12'
  )
),
(null,'column13',3, 'column33',
  (
    select
    table3.id_table3
    from
    table3
    where
    table3.table3_column1 = 'column13'
  )
);

insert into table1hastable2(table1_id_table1, table2_id_table2) VALUE
(1,1),(2,2),(3,3);