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 SELECT
statement. Here's an example query that demonstrates how to do this:
sql:-
SELECT column1 + column2 AS sum_result
FROM your_table;
Replace your_table
with the actual name of your table, and column1
and column2
with the names of the integer columns you want to add. The result will be a new column named sum_result
containing the sum of the values from column1
and column2
.
Here's a breakdown of the SQL statement:
SELECT
: Specifies the columns to retrieve.
column1 + column2 AS sum_result
: Performs the addition of column1
and column2
and assigns the result to a new column named sum_result
.
FROM your_table
: Specifies the table from which to retrieve the data. Replace your_table
with the actual name of your table.
Make sure to adapt the column and table names according to your database schema.