Deleting Data このトピックを印刷 前のページ 1つ上のレベル 次のページ

ホーム >  Retrieving and Editing Data >

Deleting Data

To delete a row from a table, DatabaseSpy provides the 「新規の SQL エディターで表示 | データの削除 option in コンテキストメニュー of the オンラインブラウザー. Selecting this option generates a DELETE statement in a new or existing SQL エディターウィンドウ.


Be sure to edit this statement in order to delete the row(s) that are obsolete since executing the statement as is will not delete any rows from the selected table (the default statement selects rows where the primary key is NULL).



To delete data from a table:

1.Connect to the database and show the 個々の data source in the オンラインブラウザー.
2.任意で、 right-click the table you want to update and choose 「データの取得 | 全ての行」 to see the data that is contained in the table.
3.オンラインブラウザー内で、 対応するテーブルを右クリックし、 「新規の SQL エディターで表示 | データの削除 をコンテキストメニューから選択、または、holding down the right mouse ボタン, drag the table into an open SQL エディターウィンドウ and choose データの削除 from the popup. A DELETE statement for the selected table is generated in the SQL エディター and a default WHERE statement is added.
4.Edit the WHERE statement accordingly to select only a particular row for deletion.


メモ:All rows of the table will be deleted if the WHERE statement is omitted.


5.Click the 実行 ic_execute-sql ボタン to execute the statement and to delete the data from the database.


Deleting data in the 結果ウィンドウ

You have two options to delete records in the 結果ウィンドウ: Either set a particular database field to NULL or delete an entire row. Both options are provided in コンテキストメニュー that is available when the 結果ウィンドウ is in the Editing mode. The affected fields or rows are marked modified until the changes are committed to the database. This enables you to also undo the editing if the need should arise.


上のスクリーンショットでは、 the CONTACTINFO field has been set to "NULL" for the third record, and the entire fifth record has been deleted. Note that the changes have not yet been committed to the database and can still be undone.



To set a database field to NULL:

1.Right-click the database field you want to change and select Set Null をコンテキストメニューから選択します。
2.ic_commit ボタンをクリックします。



To delete a row of records in the result grid:

1.Right-click one of the fields in the row you want to delete and select 行の削除 をコンテキストメニューから選択、または、click anywhere into the row and click the 行の削除 ic_delete-row ボタンをクリックします。 The row is marked for deletion (see screenshot above).
2.ic_commit ボタンをクリックします。



To restore deleted rows in the database:

Provided that the modified fields in the result grid have not been committed to the database yet, right-click into the deleted row and select Undo changes for this Cell をコンテキストメニューから選択します。 The entire row of records is restored in the result grid.

(C) 2019 Altova GmbH