What is Oracle 11g?
Oracle 11g is an RDBMS.
Structured Query Language (SQL)
Users can communicate with an RDBMS using SQL, which enables you to access and manipulate databases.
How do you access Oracle 11g?
With your mouse pointer go through the following trail:
Windows button -> All Programs -> Oracle-OraDb11g_home1 -> Application Development -> SQL Plus
For user name enter: scott.
For password enter: tiger.
If you need a host string, it will be given to you during the lab.
Do the following before working with queries
✓ Take your mouse pointer to the SQL Plus icon at the top left corner of the window and right-click the icon. Then select Layout. Enter the following values:
For Width under Screen Buffer Size, enter 120.
For Height under Screen Buffer Size, enter 300.
For Width under Window Size, enter 120.
For Height under Window Size, enter 60.
✓ At the SQL prompt, type: set linesize 100
This allows 100 characters to be displayed per line.
Then at the SQL prompt, type: set pagesize 20
This allows 20 lines to be displayed per page.
We do the above to make data in tables easy to read.
Data Retrieval using SQL
The select statement is used to retrieve data from a table.
Selecting specific columns
select ename, empno, mgr, deptno
Selecting all columns
Limiting the Rows Selected
• Restrict the rows returned by using the where clause.
select empno, ename, job
where deptno = 20;
select ename, mgr, deptno
where job = ‘MANAGER’;
• Relational operators
• Logical operators
Joining Tables Using Oracle Syntax
• Use a join to query data from more than one table.
select table1.column, table2.column