Database

Acid-1460459362.jpg

How to Backup and Restore ORACLE Database

exp userid=yourusername/youruserpassword@Connect_Identifier File=OSPath
Example
Exp userid=scott/tiger@ORCL file=c:\scott.dmp

imp userid/password@Connect_identifier fromuser=user_name_you_have_data_unloaded_from touser=new_user_name file=Path_to_*.dmp file

Drop a user from Oracle.
DROP USER CASCADE;

 

SQL_Joins.png

 

SQL Joins

SQL> select * from t1;

ID
———-
1
2
3
4

SQL> select * from t2;

ID
———-
3
4
5
6

— LEFT OUTER JOIN
SQL> select t1.id, t2.id
2 from t1 LEFT OUTER JOIN t2 ON (t1.id = t2.id);

ID ID
———- ———-
3 3
4 4
1
2

— RIGHT OUTER JOIN
SQL> select t1.id, t2.id
2 from t1 RIGHT OUTER JOIN t2 ON (t1.id = t2.id);

ID ID
———- ———-
3 3
4 4
6
5

— LEFT JOIN (SAME AS LEFT OUTER JOIN)
SQL> ed
Wrote file afiedt.buf

1 select t1.id, t2.id
2* from t1 LEFT JOIN t2 ON (t1.id = t2.id)
SQL> /

ID ID
———- ———-
3 3
4 4
1
2

— RIGHT JOIN (SAME AS RIGHT OUTER JOIN)
SQL> ed
Wrote file afiedt.buf

1 select t1.id, t2.id
2* from t1 RIGHT JOIN t2 ON (t1.id = t2.id)
SQL> /

ID ID
———- ———-
3 3
4 4
6
5

— INNER JOIN (REGULAR JOIN)
SQL> ed
Wrote file afiedt.buf

1 select t1.id, t2.id
2* from t1 INNER JOIN t2 ON (t1.id = t2.id)
SQL> /

ID ID
———- ———-
3 3
4 4

— FULL OUTER JOIN
SQL> ed
Wrote file afiedt.buf

1 select t1.id, t2.id
2* from t1 FULL OUTER JOIN t2 ON (t1.id = t2.id)
SQL> /

ID ID
———- ———-
3 3
4 4
1
2
6
5

6 rows selected.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s