Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vishal YelveRank #178 · 13.6K reputationPosted Sep 12, 2022, 9:34 AM EDT
SQL Action queries to Insert, Delete, or update data or to create a new table from existing data.
Action queries are particularly powerful because they allow you to operate on sets of data, not single rows.
For example, an UPDATE statement or a DELETE statement affects all rows in the underlying tables that meet the selection criteria you specify.
Uday DodiyaRank #239 · 10.3K reputationPosted Sep 13, 2022, 12:43 AM EDT
SQL Action Queries :
Use SQL action queries to delete, insert, or update data or to create a new table from existing data. Action queries are particularly powerful because they allow you to operate on sets of data, not single rows. For example, an UPDATE statement or a DELETE statement affects all rows in the underlying tables that meet the selection criteria you specify.
DELETE Statement :
Deletes one or more rows from a table or a query. The WHERE clause is optional. If you do not specify a WHERE clause, all rows are deleted from the table or the query that you specify in the FROM clause. If you specify a WHERE clause, the database applies the search condition to each row in the table or the query, and only those rows that evaluate to True are deleted.
UPDATE Statement :
Updates one or more rows from a table or a query. The WHERE clause is optional. If you do not specify a WHERE clause, all rows are updated from the table or the query that you specify in the FROM clause. If you specify a WHERE clause, the database applies the search condition to each row in the table or the query, and only those rows that evaluate to True are updated.
Vishal YelveRank #178 · 13.6K reputationPosted Sep 13, 2022, 10:24 AM EDT
Action queries are queries that make changes to many records at once. They are used to delete records, update records (that is, to change values in them), create new tables, delete tables, and to launch queries that accept a user-supplied parameter. Action queries are just like any other SQL query in that they use SQL and are written within a Manifold query component. They are given the special name "action" to highlight their activity in changing the tables or interacting with the user by virtue of the SQL commands they use.
Examples:
Using the Nwind.mdb sample database:
// Delete records for non-discounted orders.
DELETE FROM [Order Details] WHERE [Discount] = 0;
// Delete the Categories table (square brackets are not necessary).
DROP TABLE [Categories];
// PARAMETERS Threshold INTEGER;
// Select orders whose quantity exceeds a number entered by the user.
SELECT * FROM [Order Details] WHERE Quantity > Threshold;
Select all cities from Customers into the new table (Locations). The use of the DISTINCT quantifier suppresses duplicates.
SELECT DISTINCT [City] INTO [Locations] FROM [Customers];
// Lower prices (by 5%) on items whose quantity is too high.
UPDATE [Order Details] SET [Unit Price] = [Unit Price]*0.95 WHERE Quantity >= 30;