ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Query editor / Creating queries
  • Overview
  • How to?
  • Notes
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Creating an update query
Overview
An Update query (SQL UPDATE statement) is used to modify records in a database file.
To perform this modification, the main characteristics of the query are as follows:
  • the data file in which the data will be modified.
  • the items in which the values will be modified.
  • the selection conditions of the records (customers who live in Seattle, products whose price is greater than 40 Dollars, ...).
For more details on query selection conditions, see Selection conditions of a query.
For example, customer #45762 has got married. Her title and her last name have been modified.
Update query
The query editor automatically generates the SQL code of this query.
To see the SQL code of a query:
  1. Open the context menu of the query graph.
  2. Select "SQL code".
You also have the ability to press the F2 key.
In our example:
UPDATE
CUSTOMER
SET
Title = 'Mrs',
CustomerName = 'VAUVERT'
WHERE
Customer.CustomerNum = 45762

Reports & Queries cannot be used to create update queries.
How to?
To create a new update query:
  1. Click New in the quick access buttons.
    • The new element window appears: click "Query".
    • The query creation wizard starts.
  2. Specify that you want to create an update query ("Update" option).
  3. If your project is linked to no analysis, specify the analysis to which the query will be attached.
    Proceed to the next step of the wizard.
  4. Select the data file in which the data will be modified.
    Proceed to the next step of the wizard.
  5. For each item whose value must be modified, click the "Value/Parameter" column. A window allows you to select the value or the parameter to modify.
  6. Specify the value or the parameter containing the value to modify. The values to modify can correspond to:
    • the default value defined in the analysis.
    • a value that must be specified. Specify this value.
    • a value contained in a parameter. Specify the name of the parameter.
    • a null value.
  7. Validate your choice.
  8. Repeat the operations 5 to 7 for each item containing a value that must be modified.
  9. Define the selection conditions. Click the "Condition" column of relevant items. For more details on query selection conditions, see Selection conditions of a query.
    Proceed to the next step of the wizard.
  10. Specify (if necessary) the sequence of the selection conditions with the conditional AND and OR AND operators:
    • Conditional AND operator: the selected records will match both conditions. For example, the customers whose name starts with the letter "A" AND who live in Denver.
    • Conditional OR operator: the selected records will match one of the two conditions or both conditions. For example, the query selects the customers who live in Seattle OR in Denver.
      Proceed to the next step of the wizard.
  11. Type the query name (name of ".WDR" file corresponding to the query). This name will be used to identify the query in your programs.
  12. Specify the caption of the query by briefly describing the purpose of query. This caption will be used in the project documentation.
    Remark: The query name is automatically defined from the caption typed.
  13. Validate the query description. The graphic representation of query is automatically displayed in the query editor.
Notes
  • All the characteristics of a query can be modified: on the "Query" tab, in the "Edit" group, click "Description". For more details, see Description of a query.
  • To generate the SQL code corresponding to this query, select "SQL code" in the context menu of the query. If changes are made in the query description, these changes will be automatically reflected in the corresponding SQL code.
  • You also have the ability to create a query from one or more data files described in the data model editor: to do so, drag the data files selected in the "Analysis" pane and drop them in the query editor.
  • The test of the created query can be run from the query editor. For more details, see Testing a query.
See also
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 12/08/2023

Send a report | Local help