DB2 RazorSQL QueryBuilder
Open RazorSQL and then connect to the database.
Now right click on the selected table. You will see query builder.
QueryBuilder can be used to SELECT, SEARCH, INSERT, UPDATE and DELETE purpose. You can use it for the above all operation to build query and execute it.
SELECT Query
The SELECT option facilitates you to use all SELECT queries.
For example: You can use SELECT * for retrieving all records from the table as well as SELECT individual columns for retrieving individual records.
Example:
Retrieve All Records
Click on the SELECT * option to retrieve all records from the table. Now click on the generate SQL, you will see the generated query.
Click on the Execute SQL button.
See the result on RazorSQL main page.
You can use WHERE and GROUP BY clauses with SELECT Query. Conditions like <, >, <=, >=, =, <>, LIKE, NOT LIKE can also be used.
For example:
Let’s select address from the table “Freshers” Where address is LIKE “Allahabad”.
In the same way you can retrieve individual records.
SEARCH Query
The next option of the Query Builder is search query. You can retrieve records from the table “Fresher” by using this query method.
Let’s retrieve records from the table “Freshers” Where address != Allahabad and ID is greater than 1.
INSERT Query
You can insert a single record as well as a complete row in the table by using INSERT block.
For example:
Let’s insert the following record as a new row.
UPDATE Query
Update block is used to update the already inserted records in the table. Let’s update the table where name is “Babita” and “Age” is 25 to name “Kiran” and age 45.
12
DELETE Query
DELETE block is used to delete a specified record.
Let’s delete the records from the table “Freshers” where id >= 4 AND age <= 30.
You can see that only id < 4 is remained in the table now.