You are on page 1of 15

INDEX

S.No. Experiment Date Sign.


1 About Oracle 10g

2 To Create and Display a Table

3 To Display Column or Row in a table

4 To Display table using Constraints

5 To perform Cartesian Product on Two


Tables

6 To study and imply joins

7
EXPERIMENT 1

To Create and Display a Table in DBMS.

Description
The Oracle CREATE TABLE statement allows you to create and define a table.

Syntax
The syntax for the CREATE TABLE statement in Oracle/PLSQL is:

CREATE TABLE table_name


(
column1 datatype [ NULL | NOT NULL ],
column2 datatype [ NULL | NOT NULL ],
...
column_n datatype [ NULL | NOT NULL ]
);
Practical Application:
EXPERIMENT 2

To Display Row or Column in a Table.


EXPERIMENT 3

To Display Table using Constraints.


SQL Constraints are rules used to limit the type of data that can go into a table, to maintain
the accuracy and integrity of the data inside table.
Constraints can be divided into the following two types,

1. Column level constraints: Limits only column data.


2. Table level constraints: Limits whole table data.

Constraints are used to make sure that the integrity of data is maintained in the database.
Following are the most used constraints that can be applied to a table.

• NOT NULL
• UNIQUE
• PRIMARY KEY
• FOREIGN KEY
• CHECK
• DEFAULT
NOT NULL:

UNIQUE:
CHECK:
EXPERIMENT 4

To Perform Cartesian Product on Two Tables.

The Cartesian product, also referred to as a cross-join, returns all the rows in all the tables
listed in the query. Each row in the first table is paired with all the rows in the second table. This
happens when there is no relationship defined between the two tables.

TABLES CONSIDERED:
CARTESIAN PRODUCT:
EXPERIMENT 5

To Study and Imply Joins.


JOINS are used to retrieve data from multiple tables. A JOIN is performed whenever
two or more tables are joined in a SQL statement.
There are different types of joins:

• INNER JOIN (or sometimes called simple join)


• LEFT OUTER JOIN (or sometimes called LEFT JOIN)
• RIGHT OUTER JOIN (or sometimes called RIGHT JOIN)

TABLES considered:
INNER JOIN (simple join)

Syntax

SELECT columns
FROM table1
INNER JOIN table2
ON table1.column = table2.column;
LEFT OUTER JOIN

Syntax

SELECT columns
FROM table1
LEFT JOIN table2
ON table1.column = table2.column;
RIGHT OUTER JOIN

Syntax

SELECT columns
FROM table1
RIGHT [OUTER] JOIN table2
ON table1.column = table2.column;

You might also like