Page 339 - TP_IT_V1.0_C10_flipbpookl
P. 339

Performing Calculations in Queries
                 Many times, the user needs to perform calculations on the fields used in a table. LibreOffice Base allows the user
                 to create a query for performing such calculations. Let us say, in the table Product, the user needs to calculate Total
                 Amount as Quantity * Price.

                 To create a query for performing such calculations, follow these steps:
                 Step 1:  Create a query in design view.
                         The Query Design window open with the Add Table or Query dialog box.
                 Step 2:  Add the tables you wish to use in the query as Product tables.

                 Step 3:  Click the Close button in the Add Table or Query dialog box.
                 Step 4:  Add fields for query.
                 Step 5:  In the Field row of the Query Design window, in a blank column, type Quantity * Price.
                 Step 6:  Press the Enter key on the keyboard.
                 Step 7:  Enter a name for the field in the Alias row as Total Amount.

                 Step 8:  Save the query.





























                           When you run the query, you will notice that a new column titled Total Amount is displayed showing the
                         necessary calculations. Remember that calculation can be made only on those fields where data type used is
                         Numeric.
























                                                                        Database Management System using LibreOffice Base  337
   334   335   336   337   338   339   340   341   342   343   344