Page 252 - IT_V1.0_Class10
P. 252

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 * Unit_Price. To create a query for performing such calculations, follow
              these steps:

              Step 1:  Create a query in the Design View. Insert all the required
                       fields from the table into the query.

              Step 2:  Type  Quantity  * Unit_Price  in  the  Field  row  in  the
                       Query Design window.                                                                     2
              Step 3:  Press the Enter key on the keyboard.
              Step 4:  Enter a name for the field in the Alias row. In our case,
                       we have typed Total_Amount.

              Step 5:  Save the query with the name Product_Query.
              Step 6:  Double-click on the query in the Queries pane to run the query. Notice that a new column titled
                       Total_Amount is displayed showing the necessary calculations.











                                                                                                                 6
                                                                4





              Grouping Data in Queries
              In  business  organisations  and  companies,  the  senior  management  needs  reports  in  summary  form.  In
              such situations, a summary report can be prepared by grouping records on the basis of field that contains
              repetitive values.
              For example, consider the Stock table of a departmental store that sells items that include Kitchen Appliances,
              Furniture and Decoration. The senior management wants to know the quantity of stock under each category
              of products.












              Observe in the given table that some of the entries in the Product_Category field are repeating.

              LibreOffice Base creates queries for grouping data on the basis of:
                Group-field

                Grouping function



                250     Information Technology Play (Ver 1.0)-X
   247   248   249   250   251   252   253   254   255   256   257