Search code examples
mysqlsqlsql-insertpentahocreate-table

Dimension and fact table creating in Pentaho from single SQL table(source table)


I have one CSV file, has all info, I converted all info into the one table and stored it in MySQL. It has many fields. What is the best approach to create a table like this: How can I set the auto-increment primary key for my table and how can I get a unique name from the source table.


Solution

  • You would typically create a table with an auto_incremented primary key, and then feed it using select distinct:

    create table disticts(
        district_id int auto_increment primary key,
        district_name varchar(100)
    );
    
    insert into disticts (district_name)
    select distinct district_name from mytable