Drag and Drop from Data Source Explorer View
Dragging operations from the Data Source Explorer view and dropping them in the SQL Editor allows you to create SQL statements quickly by inserting the names of tables and columns in the SQL statements.
- Configure a database connection (see the specific procedure for your database server in the Database Connection Support section).
- Browse to the table you will use in your statement.
-
Drag the table or a column of the table into the editor where a SQL file is open.
Drag and drop actions are available both on the table and on its fields. A pop-up menu is displayed in the SQL editor.
-
Select the type of statement from the pop-up menu.
Depending on your choice, dragging a table results in one of the following statements being inserted into the document:
- SELECT `field1`,`field2`, .... FROM `catalog`.
`table` (for example:
SELECT `DEPT`,`DEPTNAME`,`LOCATION` FROM `camera`.`cameraDesc`
) - UPDATE `catalog`. `table` SET `field1`=,
`field2`=,.... (for example:
UPDATE `camera`.`cameraDesc` SET `DEPT`=, `DEPTNAME`=, `LOCATION`=
) - INSERT INTO `catalog`. `table` ( `field1`,`field2`,
....) VALUES (, , ) (for example:
INSERT INTO `camera`.`cameraDesc` (`DEPT`,`DEPTNAME`,`LOCATION`) VALUES (, , )
) - DELETE FROM `catalog`. `table` (for example:
DELETE FROM `camera`.`cameraDesc`
)
Depending on your choice, dragging a column results in one of the following statements being inserted into the document:
- SELECT `field` FROM `catalog`. `table` (for example:
SELECT `DEPT` FROM `camera`.`cameraDesc`
) - UPDATE `catalog`. `table` SET `field`= (for example:
UPDATE `camera`.`cameraDesc` SET `DEPT`=
) - INSERT INTO `catalog`. `table` ( `field1) VALUES () (for
example:
INSERT INTO `camera`.`cameraDesc` (`DEPT`) VALUES ()
) - DELETE FROM `catalog`. `table` (for example:
DELETE FROM `camera`.`cameraDesc` WHERE `DEPT`=
)
- SELECT `field1`,`field2`, .... FROM `catalog`.
`table` (for example: