Handy SQL Snips

Oct 28, 2013
Handy SQL Snips
  • These are to be used only when necessary as most of these actions can be achieved via Fabrik itself.

    Please only use these if you are comfortable that you know what they are doing.


    Insert data into columns (top)

    Code (SQL):
    INSERT INTO your_table (column1_name, column2_name, column3_name) VALUES (1, 'another value', 450);

    Insert data into multiple columns (top)

    Code (SQL):
    INSERT INTO your_table (item_name, item_color)
    VALUES ('a boingle', 'blue'),
            ('a doingle', 'red'),
            ('a foingle', 'yellow'),
            ('a poingle', 'aqua'),
            ('a qoingle', 'green'),
            ('a shoingle', 'purple'),
            ('a loingle', 'orange');

    Delete a column (top)

    Code (SQL):
    ALTER TABLE your_table DROP COLUMN column_name;

    Change the ordering of your columns in the database table (top)

    Code (SQL):
    ALTER TABLE TABLE_NAME CHANGE field_name field_name INT(6) AFTER another_field;