Home / Computer Science / Oracle / Oracle – Tutorial Part -1

Oracle – Tutorial Part -1

Know the database management concept is essential to everyone, as a fresher must have knowledge in any database like MySql, Oracle..etc.

Now I am using Oracle to give brief explanation about the creation deletion updating of the database table.

Oracle provides Enterprise, mobile Express editions. Express edition is light weight and free.

History of Oracle: Oracle Corporation is an American Multinational Computer technology corporation, headquartered in Redwood shores, California. The company primarily specializes in developing and marketing  data base software and technology. In 2015 Oracle was the second largest software marker by revenue,after Microsoft.

Oracle was originally developed by Lawrence Ellison (Larry Ellision) and his two friends Bob Miner and Ed Oates with name Software Development laboratories in 1977.  Ellison consider the Edgar Codd’s paper on relational database management system.  Oracle DB runs on the most major platforms like Windows, UNIX, Linux and Mac OS.

Create a table Employe:

SQL> create table Employe(

2  emp_id number(5) not null,

3  emp_name varchar2(30) not null,

4  address varchar2(30) not null,

5  primary key(emp_id));

Table created.

Create Table
Create Table

To view table Employe:

Use the below command

Syntax: SQL> desc tablename;

Example : SQL>desc employe;

view table
view table

Desc means describe the table.

Insert the data into the table syntax.

SQL> INSERT INTO table (column1,column2,……column) values (value1,vlaue2,….valuen);

Example: SQL> insert into Employe values(1001,’santosh’,’visakhapatnam’);

1 row created.

SQL> insert into Employe values(1002,’ram’,’Hyderabad’);

1 row created.

SQL> insert into Employe values(1003,’pavan’,’Mumbai’);

1 row created.

Insert record
Insertion of records

To view all the records in the table.

Select all records
All records

 ALTER table:

Modifying the existing table in oracle:

ALTER is a command in oracle to modify the existing table.

By using ALTER we can add, rename, modify, drop the columns in the table.

Add a column existing table:

Alter
Alter Command

Syntax:  ALTER TABLE table_name   ADD column_name column-definition;

Add a phone column to the employe table;

SQL> ALTER TABLE employe ADD phone number(10) ;

Modify the column in the table.

Alter
Alter

SQL> ALTER TABLE table_name MODIFY column_name column_definition;

Modify the address column size in the employe table.

SQL> ALTER TABLE employe MODIFY address  varchar2(50);

Drop the column in table.

SQL> ALTER TABLE table_name DROP  COLUMN Column_name ;

Drop the address2 column in the employe table.

Drop Column
Drop Column

SQL> ALTER TABLE employe DROP COLUMN address2;

Rename the column name in the table.

Syntax: SQL> ALTER TABLE table_name RENAME COLUMN old_column_name to new_column_name;

SQL>ALTER TABLE employe RENAME COLUMN address to emp_address;

Rename
Rename

About GSK

Hi, i am Santosh Gadagamma, a tutor in Software Engineering and an enthusiast for sharing knowledge in Computer Science and other domains. I developed this site to share knowledge to all the aspirants of technologies like, Java, C/C++, DBMS/RDBMS, Bootstrap, Big Data, Javascript, Android, Spring, Hibernate, Struts and all levels of software project design, development, deployment, and maintenance. As a programmer I believe that, "The world now needs computers to function." Hope, this site guides you as a learning tool towards greater heights. I believe that Education has no end points and i wish to learn more in the process of teaching you.