What are the most important types of action queries in sql ?
Loading
What are the most important types of action queries in sql ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vishal YelvePosted Sep 13, 2022, 2:24 PM
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;
Uday DodiyaPosted Sep 13, 2022, 4:43 AM
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 YelvePosted Sep 12, 2022, 1:34 PM
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.