Drag and Drop from Data Source Explorer View

Drag and drop(DND) from the Data Source Explorer view to the SQL editor allows creating SQL statements quickly by inserting the names of tables and columns in the SQL statements.
  1. Configure a database connection (see the procedure specific for your database server).
  2. Browse to the table you will use in your statement.
  3. Drag the table or a column of the table into the editor where a SQL file is open.

    DND is available both on the table and on its fields. A popup menu is displayed in the SQL editor.

    SQL statement editing with DND

  4. Select the type of statement from the popup menu.

    If you dragged a table depending on your choice, one of the following statements are inserted into the document:

    • SELECT `field1`,`field2`, .... FROM `catalog`. `table` (for this example: SELECT `DEPT`,`DEPTNAME`,`LOCATION` FROM `test`.`department` )
    • UPDATE `catalog`. `table` SET `field1`=, `field2`=,.... (for this example: UPDATE `test`.`department` SET `DEPT`=, `DEPTNAME`=, `LOCATION`=)
    • INSERT INTO`catalog`. `table` ( `field1`,`field2`, ....) VALUES (, , ) (for this example: INSERT INTO `test`.`department` (`DEPT`,`DEPTNAME`,`LOCATION`) VALUES (, , ))
    • DELETE FROM `catalog`. `table` (for this example: DELETE FROM `test`.`department`)

    If you dragged a column depending on your choice, one of the following statements are inserted into the document:

    • SELECT `field` FROM `catalog`. `table` (for this example: SELECT `DEPT` FROM `test`.`department` )
    • UPDATE `catalog`. `table` SET `field`= (for this example: UPDATE `test`.`department` SET `DEPT`=)
    • INSERT INTO`catalog`. `table` ( `field1) VALUES () (for this example: INSERT INTO `test`.`department` (`DEPT`) VALUES ())
    • DELETE FROM `catalog`. `table` (for this example: DELETE FROM `test`.`department` WHERE `DEPT`=)