Order by three columns : Order By « Select Query « Oracle PL / SQL






Order by three columns

  

SQL>
SQL> CREATE TABLE products(
  2    product_id              NUMBER(6),
  3    name            VARCHAR2(50),
  4    subcategory        VARCHAR2(50),
  5    category           VARCHAR2(50),
  6    pack_size          VARCHAR2(30),
  7    price         NUMBER(8,2),
  8    min_price          NUMBER(8,2)
  9  );

Table created.

SQL>
SQL>
SQL> select category, subcategory, name, price
  2  from   products
  3  where  price > 100
  4  order by category, subcategory, name;

no rows selected

SQL> drop table products;

Table dropped.

   
    
  








Related examples in the same category

1.Ordering data in the SELECT statement ascending
2.Order two columns
3.Query a number type column with order by desc
4.ORDER BY clause with more than one column:by the first column, and within that column, orders by the second
5.Specify ascending or descending for each column
6.Ordering data in the SELECT statement descending
7.Order the results by the average salary
8.Query specific columns with order by clause
9.Use aggregate function in order by clause
10.Query the same column in where statement and order by clause
11.order by 3, 2, 1
12.Get order number by using rownum column
13.DESC for descending
14.ORDER BY with all logic operators
15.Order by date value then by number value
16.Order by columns from different tables
17.Order by index
18.Order by job title ascending but birthday descending
19.Order by name and department number for salary higher than 1500
20.Order by price which is more than 50
21.Order by renamed column
22.Order by renamed column descendingly
23.Order by, range unbounded preceding
24.Order date value by only year field with extract() function
25.Order for one column descendingly