. Oracle Database is developed by Oracle Corporation which is one of the most popular databases used nowadays for various applications.
. It is available in different versions like Oracle 10g, Oracle 11g, Oracle 12 c.
. When we download Oracle database, it provides database and Client program called "Run SQL Command Line" to write queries for the database.
. Download Oracle database from internet.
. Click on Accept Agreement and download setup file which is related to OS of computer.
. After downlading, unzip the folder and open setup file and install it.
. It opens installation setup. Click on Next.
. Accept the license agreement and click on Next.
. Select the destination folder and click on Next.
. Give a password for the database account SYSTEM.
. Finally click on Install.
. Accept the license agreement and click on Next.
. Select the destination folder and click on Next.
. Give a password for the database account SYSTEM.
. Finally click on Install.
. Now open the SQL command prompt.
. It opens a SQL Command window as follows:
. Enter connect followed by user-name and password which we set during installation.
Creating a Table:
. Table can be created using the following syntax:
CREATE TABLE table_name (Column_1 datatype, Column_1 datatype, Column_1 datatype);
Inserting data into tables:
. Data can be inserted into the tables using the following syntax:
INSERT INTO table_name VALUES(List of values separated by commas);
Reading data from table:
. We use the following command to read data from table:
SELECT * FROM table_name;
. To read specific column data from a table, we can use the following syntax:
SELECT column1, column2 FROM table_name;
Updating data in a table:
. We use the following command to update the record in table:
UPDATE table_name SET Column_name=new_value WHERE condition
Using Constraints using ALTER command:
. Alter command can be used in many ways.
. We can add, delete, change datatype of a column and also we can add a constraint to the column.
. Below command shows how to add a constraint using Alter command.
ALTER TABLE table_name ADD CONSTRAINT constraint_name PRIMARY KEY(Column_name);
. After adding a primary key, try to insert a row with duplicate data, it shows error.
Filtering Data:
. Filtering data means it displays the data as mentioned in the condition written after WHERE.
Deleting a record:
. Following command is used to delete a record from a table:
DELETE FROM table_name WHERE condition
Rollback:
. Rollback command is used to undo the previous action.
Commit:
. It is used to save the last action permanently.
. After committing, data cannot be restored back.