Creating Database connection

Creating database connection
  • Oracle SQL Developer enables developers and DBAs to browse, create,and update data in a database.
  • You must have at least one database connection to use Oracle SQL Developer.
Steps to create Database connection in Oracle SQL Developer
Step 1: Right click on connection and select new connection
c1

Step 2: Define Connection name
give username and password which you have given during installation    
and define Connection type as TNS and select Role SYSDBA  
Select SID as ORCL and Click on Test to Test the Connection

c2

Step 3: If it is showing success message then click on connect

c3

Step 4: Now Our connection successfully created          
You can write and run query.

c4

Step 5: Query to get all table name of database schema

c5

Retrieving data Using Select statement

Basic Rules for writing SQL Statement.
–- SQL statements are not case-sensitive.
–- SQL statements can be entered on one or more lines.
–- Keywords cannot be abbreviated or split across lines.
–- Clauses are usually placed on separate lines.
–- Indents are used to enhance readability
Selection vs Projection
Projection
Selecting Columns from table without where clause
Selection
Selecting rows from table using where clause condition
Query to see list of all table from database
Select *from tab;
Viewing all column from table

Query:

select *from employees;

g1
Viewing specific column from table

Query:

select First_name, last_name from employees;

g2
Giving alias name to column
Query:

SELECT first_name, salary "monthly salary" FROM employees


g3
Using concatenation operator in Select statement
Query:

 SELECT first_name || last_name FROM employees


g4
Display Unique value from column
Query:

 SELECT distinct department_id from employees
g5