Useful SQL queries.

I found the below queries to be quite useful when working in the SQL or PL/SQL environment:

You can run this query to get the database parameters:
select * from v$parameter;

To get the number of sessions for AB:
select * from  AB.ps_txn order by creation_date;

Find all tables and filter them out by containing SEARCH_CRITERIA:
select owner, table_name from dba_tables where table_name like '%SEARCH_CRITERIA%' order by table_name desc;

Get table data:
desc TABLE_NAME;

Get all DB users with username UNAME:
select * from dba_users where username like '%USERNAME%'

Select 1% of table contents:
select * a_table sample (1);

Comments

Popular posts from this blog

Whitelist an Azure firewall IP using PowerShell

Excel: highlighting a row or a column based a value, the current date example.