-> HR.EMPLOYEES will be test table.
SQL>
DESC HR.EMPLOYEES;
e.g.
To populate all data
SQL>
SELECT * FROM HR.EMPLOYEES;
To manipulate data by "COMMISSION_PCT" column descending order.
SQL>
SELECT *
FROM HR.EMPLOYEES
ORDER BY COMMISSION_PCT DESC;
-> This is wrong query cause "NULL" columns show on top. Therefore, "NULLS LAST" keyword should be used.
SQL>
SELECT *
FROM HR.EMPLOYEES
ORDER BY COMMISSION_PCT DESC NULLS LAST;
Showing posts with label desc. Show all posts
Showing posts with label desc. Show all posts
Friday, 30 March 2018
Tuesday, 25 July 2017
SQL PLUS system parameters usage (set/show)
To show parameter in detail
SQL> SHOW DEFINE;
To escape from substitution variable (&):
SQL> SET DEFINE OFF;
To enable DBMS_OUTPUT:
SQL> SET SERVEROUTPUT ON;
To see old and new values of variables:
SQL> SET VERIFY ON;
To calculate total execution time of SQL:
SQL> SET TIMING ON;
To print time on the SQL terminal:
SQL> SET TIME ON;
To see table columns name and types for a table:
SQL> DESC hr.employees@XE;
To see currently logged-in user:
SQL> SHOW user;
SQL> SHOW DEFINE;
To escape from substitution variable (&):
SQL> SET DEFINE OFF;
To enable DBMS_OUTPUT:
SQL> SET SERVEROUTPUT ON;
To see old and new values of variables:
SQL> SET VERIFY ON;
To calculate total execution time of SQL:
SQL> SET TIMING ON;
To print time on the SQL terminal:
SQL> SET TIME ON;
To see table columns name and types for a table:
SQL> DESC hr.employees@XE;
To see currently logged-in user:
SQL> SHOW user;
Subscribe to:
Posts (Atom)