# Math calculation in select : Select « Select Query « Oracle PL / SQL

Home
Oracle PL / SQL
 1 Aggregate Functions 2 Analytical Functions 3 Char Functions 4 Constraints 5 Conversion Functions 6 Cursor 7 Data Type 8 Date Timezone 9 Hierarchical Query 10 Index 11 Insert Delete Update 12 Large Objects 13 Numeric Math Functions 14 Object Oriented Database 15 PL SQL 16 Regular Expressions 17 Report Column Page 18 Result Set 19 Select Query 20 Sequence 21 SQL Plus 22 Stored Procedure Function 23 Subquery 24 System Packages 25 System Tables Views 26 Table 27 Table Joins 28 Trigger 29 User Previliege 30 View 31 XML
 Oracle PL / SQL » Select Query » Select

Math calculation in select
 ```    SQL> SQL> CREATE TABLE purchase (   2       product_name  VARCHAR2(25),   3       product_price NUMBER(4,2),   4       sales_tax     NUMBER(4,2),   5       purchase_date DATE,   6       salesperson   VARCHAR2(3)); Table created. SQL> SQL> INSERT INTO purchase VALUES ('Product Name 1', 1, .08, '5-NOV-00', 'AB'); 1 row created. SQL> INSERT INTO purchase VALUES ('Product Name 2', 2.5, .21, '29-JUN-01', 'CD'); 1 row created. SQL> INSERT INTO purchase VALUES ('Product Name 3', 50.75, 4.19, '10-DEC-02', 'EF'); 1 row created. SQL> INSERT INTO purchase VALUES ('Product Name 4', 99.99, 8.25, '31-AUG-03', 'GH'); 1 row created. SQL> SQL> SQL> SQL> SELECT product_name, sales_tax / product_price FROM purchase; PRODUCT_NAME              SALES_TAX/PRODUCT_PRICE ------------------------- ----------------------- Product Name 1                                .08 Product Name 2                               .084 Product Name 3                         .082561576 Product Name 4                         .082508251 4 rows selected. SQL> SQL> SQL> DROP TABLE purchase; Table dropped. SQL> SQL>            ```
Related examples in the same category
 1 The following code provides a breakdown of the basic SELECT statement on the Oracle platform: 2 Use Arithmetic operators with literal values to derive values: add 5 to salary 3 SELECT statement uses the not equal (< >) operator in the WHERE clause 4 Using the > operator 5 UPPER(SUBSTR(first_name, 2, 8)): Combining Functions 6 Plus in select statement 7 Minus in select 8 CONCATENATING TEXT 9 Returning All Columns 10 Returning Multiple Columns 11 Returning Rows Call 12 Employees from new york who have gifts 13 Find all employees who are younger than employee whose id is 9999 14 Selecting Categories That Contain Product 15 Selecting Products That Belong to Category 16 Selecting Products That Belong to Department with Join 17 Using select statement and char function to create insert statement