I would like to add two integer columns in a table with the database Informix (IBM Informix Dynamic Server Version 14.10) , let's call these table articles. The first column is price and the second column is tax. From this I would like to calculate the total price for an article.
The table for articles looks like this:
| id | name | price | tax |
|---|---|---|---|
| 1 | apple | 50 | 6 |
| 2 | banana | 20 | 3 |
| 3 | ... | ... | ... |
How would the SQL statement in Informix look like for this?
How is this expression called in Informix?
In Informix, you can add the values of two integer columns in a table using a
SELECTstatement. Here's an example query that demonstrates how to do this:Replace
your_tablewith the actual name of your table, andcolumn1andcolumn2with the names of the integer columns you want to add. The result will be a new column namedsum_resultcontaining the sum of the values fromcolumn1andcolumn2.Here's a breakdown of the SQL statement:
SELECT: Specifies the columns to retrieve.column1 + column2 AS sum_result: Performs the addition ofcolumn1andcolumn2and assigns the result to a new column namedsum_result.FROM your_table: Specifies the table from which to retrieve the data. Replaceyour_tablewith the actual name of your table. Make sure to adapt the column and table names according to your database schema.