Practical File
UGCA 1925
DBMS Lab
Submitted By: Submitted To:
Sourav Mr. Daljeet Singh
BCA (Semester IV) Assistant Professor
Univ. Roll No:1933203
Class Roll No.:194016
(Session 2020 – 2021)
School of Information Technology
Apeejay Institute of Management & Engineering
Technical Campus, Jalandhar
Oracle
Its database is also known as simply Oracle also. It is a multi-model relational database
management system, mainly designed for enterprise grid computing and data warehousing. It is
one of the first choices for enterprises for cost-effective solutions for their applications and data
management. It supports SQL as a query language to interact with the database.
Currently, its database comes in five different editions based on the features available.
Standard Edition One: It is suitable for single-server or highly branched business
applications with limited features.
Standard Edition: It delivers all facilities provided in Standard Edition One. In addition, it
provides larger machine support and Oracle Real Application clustering service.
Enterprise Edition: This edition is packed with features like security, performance,
scalability, and availability, required for highly-critical applications in which online
transaction processing is involved.
Express Edition: It is an entry-level edition that is free to download, install, manage,
develop and deploy.
Personal Edition: It comes with the same features of Enterprise edition except Oracle
Real Application Clustering.
Features of Oracle:
An Oracle database offers the following features to meet the requirements of powerful
database management:
Scalability and Performance: Features like Real Application Clustering and Portability make an
Oracle database scalable according to the usage. In a multiuser database, it is required to
control data consistency and concurrency which are contemplated by Oracle.
Availability: Real-time applications require high data availability. High performing
computing environments are configured to provide all-time data availability. Data is
available during the time of planned or unplanned downtimes and failures.
Backup and Recovery: Its layout complete recovery features to recover data from almost
all kinds of failures. In case of failure, the database needs to be recovered within no time
for high availability. Unaffected parts of data are available while the affected ones are
getting recovered.
Security: Securing the data is always the top priority. Oracle provides mechanisms to
control data access and usage. Implementing authorization and editing user actions can
prevent unauthorized access and allow distinct access to the users.
Importance of Oracle:
It is among the oldest companies which provide database management solutions. The company
has always focused on Enterprise requirements and acknowledged the latest technology trends.
That’s why its products are always embellished with new features. For instance, the latest
Oracle database 19C is available on Oracle Cloud as well. Oracle offers users to choose from the
different database editions which suit their needs in order to provide a cost-effective solution.
History Of Oracle:
Oracle is most widely used Database Management System in most of the [Link] uses
SQL pronounced as ‘Sequel’ language to data manipulation and operations on data.I am
explaining History of Oracle in this article. ‘SEQUEL’ stands for ‘Structured English Query
Language’ which is developed by IBM Corporation limited to use codd’s model in [Link] 1979
Oracle introduced first commercially available implementation of [Link] SQL is called as
Standard RDBMS [Link] Corporation was started by two computer programmers,
Larry Ellison and Bob Miner in 1977. Both Larry and Bob had prior experience in building
database programs for different companies. Their first project was building a special database
program for the CIA (Central Intelligence Agency).
Different Versions Of Oracle:
In 1977, SEL (Software Development Laboratory) … V1
In 1979, RSI (Relational S/W Incorporation) …. V2
In 1983, Oracle Corporation à Oracle 3 [Developed Using ‘C’, which supports simple
queries but does not support transactions]
In 1984, Oracle 4 Supports Transactions [Commit/Rollback]
In 1985, Oracle 5 Client-Server Architecture [Only install DB in Server, so that ‘N’ no of
Clients can connect is known as Client-Server Architecture].
In 1989, Oracle 6 PL/SQL
In 1992, Oracle 7 Supports DWH [OLAP-Online Analytical Processing]
In 1997, Oracle 8 ORDMBS
In 1999, Oracle 8i ‘I’ means Internet & it has inbuilt JVM (JAVA Virtual Machine)
In 2001, Oracle 9i with 400 New features, e.g. XML (X tended Markup Language), RAC
(Real Application Clusters) etc which provided high availability & performance.
In 2003, Oracle 10g ‘g’ means grid (group of DB Servers)
In 2006, Oracle 11g we can add columns with values etc.
In July 2014 Oracle 12 C is launched which means oracle with Cloud.
In Feb 2018 Oracle 18 C is launched which is worlds first autonomous database
SQL
SQL is Structured Query Language, which is a computer language for storing, manipulating and
retrieving data stored in a relational database.
SQL is the standard language for Relational Database System. All the Relational Database
Management Systems (RDMS) like MySQL, MS Access, Oracle, Sybase, Informix, Postgres and
SQL Server use SQL as their standard database language.
Login to use Oracle Live SQL:
So here is the link that you need to open to register for Oracle Live SQL
[Link]
In the opened page you can see the “Sign In” option. Click on it and you will get the following
drop down
Click on the “Sign up for an Oracle Account” and you will get this form
Fill this form with all your details. Be sure to fill those with *. Once you complete this form click
on “Create Account” button and your account will be created. You will receive a mail from
Oracle in your mentioned email account.
Open the mail box and click on “Confirm Email” link and you will be taken back to Oracle page.
Now in your browser open link [Link] and log in with your user name and
password you just used to create your account.
You will log in your Oracle Account and see this interface
Click on SQL Worksheet and you will open the editor interface. Here you can write your
assignment queries and run them by clicking on the run button.
SQL Commands
The standard SQL commands to interact with relational databases are CREATE, SELECT, INSERT,
UPDATE, DELETE and DROP. These commands can be classified into the following groups based
on their nature −
DDL - Data Definition Language:
CREATE : Creates a new table, a view of a table, or other object in the database.
ALTER: Modifies an existing database object, such as a table.
DROP:Deletes an entire table, a view of a table or other objects in the database.
DML - Data Manipulation Language:
SELECT: Retrieves certain records from one or more tables.
INSERT: Creates a record.
UPDATE: Modifies records.
DELETE: Deletes records.
DCL - Data Control Language:
GRANT:Gives a privilege to user.
REVOKE:Takes back privileges granted from user.
SQL Data Types
SQL data types can be broadly divided into following categories.
1. Numeric data types such as int, tinyint, bigint, float, real, etc.
2. Date and Time data types such as Date, Time, Datetime, etc.
3. Character and String data types such as char, varchar, text, etc.
4. Unicode character string data types, for example nchar, nvarchar, ntext, etc.
5. Binary data types such as binary, varbinary, etc.
6. Miscellaneous data types – clob, blob, xml, cursor, table, etc.
SQL Data Types important points:
Not all data types are supported by every relational database vendor. For example,
Oracle database doesn’t support DATETIME and MySQL doesn’t support CLOB data type. So
while designing database schema and writing SQL queries, make sure to check if the data types
are supported or not.
Data types listed here doesn’t include all the data types, these are the most popularly
used data types. Some relational database vendors have their own data types that might be not
listed here. For example, Microsoft SQL Server has money and smallmoney data types but since
it’s not supported by other popular database vendors, it’s not listed here.
Every relational database vendor has its own maximum size limit for different data
types, you don’t need to remember the limit. Idea is to have the knowledge of what data type
to be used in a specific scenario.
SQL Numeric Data Types:
Datatype From To
Bit 0 1
tinyint 0 255
smallint -32,768 32,767
Int -2,147,483,648 2,147,483,647
bigint -9,223,372,036, 854,775,808 9,223,372,036, 854,775,807
decimal -10^38 +1 10^38 -1
numeric -10^38 +1 10^38 -1
float -1.79E + 308 1.79E + 308
Real -3.40E + 38 3.40E + 38
SQL Date and Time Data Types:
Datatype Description
DATE Stores date in the format YYYY-MM-DD
TIME Stores time in the format HH:MI:SS
DATETIME Stores date and time information in the format YYYY-MM-DD HH:MI:SS
TIMESTAM Stores number of seconds passed since the Unix epoch (‘1970-01-01 [Link]’
P UTC)
Stores year in 2 digits or 4 digit format. Range 1901 to 2155 in 4-digit format.
YEAR
Range 70 to 69, representing 1970 to 2069.
SQL Character and String Data Types:
Datatype Description
CHAR Fixed length with a maximum length of 8,000 characters
VARCHAR Variable-length storage with a maximum length of 8,000 characters
VARCHAR(max Variable-length storage with provided max characters, not supported in
) MySQL
TEXT Variable-length storage with maximum size of 2GB data
Note that all the above data types are for character stream, they should not be used with
Unicode data.
SQL Unicode Character and String Data Types:
Datatype Description
NCHAR Fixed length with maximum length of 4,000 characters
NVARCHAR Variable-length storage with a maximum length of 4,000 characters
NVARCHAR(max
Variable-length storage with provided max characters
)
NTEXT Variable-length storage with a maximum size of 1GB data
Note that above data types are not supported in MySQL database.
SQL Binary Data Types:
Datatype Description
BINARY Fixed length with a maximum length of 8,000 bytes
VARBINARY Variable-length storage with a maximum length of 8,000 bytes
VARBINARY(max) Variable-length storage with provided max bytes
IMAGE Variable-length storage with maximum size of 2GB binary data
SQL Miscellaneous Data Types:
Datatype Description
CLOB Character large objects that can hold up to 2GB
BLOB For binary large objects
XML for storing XML data
JSON for storing JSON data
The SQL CREATE TABLE Statement :
The CREATE TABLE statement is used to create a new table in a database.
Syntax:
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
....
);
The column parameters specify the names of the columns of the [Link] datatype parameter
specifies the type of data the column can hold (e.g. varchar, integer, date, etc.).
Example:
CREATE TABLE data (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);
Output:
Column Null? Type
PERSONID - NUMBER
LASTNAME - VARCHAR2(255)
FIRSTNAME - VARCHAR2(255)
ADDRESS - VARCHAR2(255)
CITY - VARCHAR2(255)
Integrity Constraints in SQL
When designing the database schema, integrity constraints are added. It defines constraints in
SQL DDL commands such as 'CreateTable' and 'Alter Table.'
Integrity Constraints are the protocols that a table's data columns must follow. These are used
to restrict the types of information that can be entered into a table. This means that the data in
the database is accurate and reliable. You may apply integrity Constraints at the column or
table level. The table-level Integrity constraints apply to the entire table, while the column level
constraints are only applied to one column.
The following are some types of constraints:
The NOT NULL constraint prevents a column from having a NULL value.
When no value is defined for a column, the DEFAULT Constraint provides a default
value.
A UNIQUE Constraint ensures that any value in a column is unique.
Each row/record in a database table is uniquely identified by the PRIMARY Key.
A FOREIGN KEY recognizes a row/record in any database table uniquely.
NOT NULL CONSTRAINTS
The not null constraint tells a column that it can't have any null values in it. This is also a type of
integrity constraint. This forces a field to always have a value, meaning you can't create a new
record or change an existing one without adding a value to it.
Syntax:
Create table table_name
(
Column_name1 datatype NOT NULL,
Column_name2 datatype,
......
Column_namendatatype,
)
Example:
CREATE TABLE purchase_orders (
vendor_id NUMBER NOT NULL,
po_status NUMBER(1,0) NOT NULL,
created_at TIMESTAMP WITH TIME ZONE NOT NULL
);
Output:
Column Null? Type
NOT
PO_NR NUMBER
NULL
NOT
VENDOR_ID NUMBER
NULL
NOT
PO_STATUS NUMBER(1,0)
NULL
CREATED_A NOT
TIMESTAMP(6) WITH TIME ZONE
T NULL
Unique Constraints
The UNIQUE Constraint prevents two records from having identical values in a column. In the
CUSTOMERS table, for example, you might want to prevent two or more people from having an
identical age.
Example:
CREATE TABLE CUSTOMERS(
ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL UNIQUE,
ADDRESS CHAR (25) ,
SALARY DECIMAL (18, 2)
);
Output:
Column Null? Type
ID NOT NULL NUMBER
NAME NOT NULL VARCHAR2(20)
AGE NOT NULL NUMBER
ADDRES
- CHAR(25)
S
SALARY - NUMBER(18,2)
Primary Key Constraint
The PRIMARY KEY constraint uniquely identifies each record in a table.
Primary keys must contain UNIQUE values, and cannot contain NULL values.
A table can have only ONE primary key; and in the table, this primary key can consist of single
or multiple columns (fields).
Example:
CREATE TABLE Persons (
ID int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int,
PRIMARY KEY (ID)
);
Output:
Column Null? Type
ID NOT NULL NUMBER
LASTNAME NOT NULL VARCHAR2(255)
FIRSTNAME - VARCHAR2(255)
AGE - NUMBER
Foreign Key Constraint
The FOREIGN KEY constraint is used to prevent actions that would destroy links between tables.
A FOREIGN KEY is a field (or collection of fields) in one table, that refers to the PRIMARY KEY in
another table.
Example:
CREATE TABLE Persons (
PersonID int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Age int,
PRIMARY KEY (PersonID)
);
insert into Persons
values(1,'Khatta','Ruby', 19 )
insert into Persons
values(2,'Singh','Manmeet', 20 )
insert into Persons
values(3,'Kaur','Jagdeep', 19 )
select * from Persons ;
CREATE TABLE Orders (
OrderID int NOT NULL,
OrderNumber int NOT NULL,
PersonID int,
PRIMARY KEY (OrderID),
FOREIGN KEY (PersonID) REFERENCES Persons(PersonID)
);
insert into Orders
values(1,4667,3)
insert into Orders
values(2,4668,2)
select * from orders ;
output:
PERSONI
D LASTNAME FIRSTNAME AGE
1 Khatta Ruby 19
2 Singh Manmeet 20
3 Kaur Jagdeep 19
ORDERID ORDERNUMBER PERSONID
2 4668 2
1 4667 3
Check Constraints in MySQL
The Check Constraint is used to enforce domain integrity. Domain integrity means the values
that are going to store in a table column must be followed by some defined rules such as range,
type, and format. In other words, we can say that Check Constraint ensures the valid entries for
a given column value by restricting the type of the value, the format of the data, or the range of
possible values.
The CHECK Constraint can be applied to single or multiple columns of a table.
Syntax:
Create table tablename(
Column 1 datatype,
Column 2 datatype,
Check (column 1>0)
Example:
CREATE TABLE parts (
part_no VARCHAR(18) PRIMARY KEY,
description VARCHAR(40),
cost DECIMAL(10,2 ) NOT NULL CHECK (cost >= 0),
price DECIMAL(10,2) NOT NULL CHECK (price >= 0)
);
insert into parts
values('AB1','ice cream',20,10)
insert into parts
values('AB2','kurkure',30,10)
insert into parts
values('AB3','chips ',40,50)
insert into parts
values('AB4','coffee',20,-10)
select * from parts ;
Output:
PART_N
O DESCRIPTION COST PRICE
AB1 ice cream 20 10
AB2 kurkure 30 10
AB3 chips 40 50
ALTER TABLE Statement
The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.
The ALTER TABLE statement is also used to add and drop various constraints on an existing
table.
syntax:
ALTER TABLE table_name
ADD column_name datatype;
Example:
create table State
SNo varchar2(5) PRIMARY KEY,
SName varchar2(20) UNIQUE,
City varchar2(20)
alter table state
add country varchar2(30);
desc state;
Output:
Column Null? Type
NOT
SNO VARCHAR2(5)
NULL
SNAME - VARCHAR2(20)
CITY - VARCHAR2(20)
COUNTRY - VARCHAR2(30)
DROP TABLE Statement
The DROP TABLE statement allows you to remove or delete a table from the SQL database.
Syntax:
DROP TABLE table_name;
Example:
create table State
SNo varchar2(5) PRIMARY KEY,
SName varchar2(20) UNIQUE,
City varchar2(20)
drop table state;
output:
Table dropped.
Relational Algebra
Relational algebra is a procedural query language. It gives a step by step process to obtain the
result of the query. It uses operators to perform queries.
Types of Relational operation :
[Link] Operation:
o The select operation selects tuples that satisfy a given predicate.
o It is denoted by sigma (σ).
Notation: σ p(r)
Notation: σ p(r)
Where:
σ is used for selection prediction
r is used for relation
p is used as a propositional logic formula which may use connectors like: AND OR and NOT.
These relational can use as relational operators like =, ≠, ≥, <, >, ≤.
For example: LOAN Relation
BRANCH_NAME LOAN_NO AMOUNT
Downtown L-17 1000
Redwood L-23 2000
Perryride L-15 1500
Downtown L-14 1500
Mianus L-13 500
Roundhill L-11 900
Perryride L-16 1300
Input:
1. σ BRANCH_NAME="perryride" (LOAN)
σ BRANCH_NAME="perryride" (
Output:
BRANCH_NAME LOAN_NO AMOUNT
Perryride L-15 1500
Perryride L-16 1300
2. Project Operation:
o This operation shows the list of those attributes that we wish to appear in the result.
Rest of the attributes are eliminated from the table.
o It is denoted by ∏.
1. Notation: ∏ A1, A2, An (r)
Notation: ? A1, A2, An (r)
Where
A1, A2, A3 is used as an attribute name of relation r.
Example: CUSTOMER RELATION
NAME STREET CITY
Jones Main Harrison
Smith North Rye
Hays Main Harrison
Curry North Rye
Johnson Alma Brooklyn
Brooks Senator Brooklyn
Input:
1. ∏ NAME, CITY (CUSTOMER)
? NAME, CITY (CUSTOMER)
Output:
NAME CITY
Jones Harrison
Smith Rye
Hays Harrison
Curry Rye
Johnson Brooklyn
Brooks Brooklyn
3. Union Operation:
o Suppose there are two tuples R and S. The union operation contains all the tuples that
are either in R or S or both in R & S.
o It eliminates the duplicate tuples. It is denoted by ∪.
?
1. Notation: R ∪ S
Notation: R S
A union operation must hold the following condition:
o R and S must have the attribute of the same number.
o Duplicate tuples are eliminated automatically.
Example:
DEPOSITOR RELATION
CUSTOMER_NAME ACCOUNT_NO
Johnson A-101
Smith A-121
Mayes A-321
Turner A-176
Johnson A-273
Jones A-472
Lindsay A-284
BORROW RELATION
CUSTOMER_NAME LOAN_NO
Jones L-17
Smith L-23
Hayes L-15
Jackson L-14
Curry L-93
Smith L-11
Williams L-17
Input:
?
1. ∏ CUSTOMER_NAME (BORROW) ∪ ∏ CUSTOMER_NAME (DEPOSITOR)
? CUSTOMER_NAME (BORROW) ? CUSTOMER_NAME (DEPOSITOR)
Output:
CUSTOMER_NAME
Johnson
Smith
Hayes
Turner
Jones
Lindsay
Jackson
Curry
Williams
Mayes
4. Set Intersection:
o Suppose there are two tuples R and S. The set intersection operation contains all tuples
that are in both R & S.
o It is denoted by intersection ∩.
1. Notation: R ∩ S
Notation: R n S
Example: Using the above DEPOSITOR table and BORROW table
Input:
1. ∏ CUSTOMER_NAME (BORROW) ∩ ∏ CUSTOMER_NAME (DEPOSITOR)
? CUSTOMER_NAME (BORROW
Output:
CUSTOMER_NAME
Smith
Jones
5. Set Difference:
o Suppose there are two tuples R and S. The set intersection operation contains all tuples
that are in R but not in S.
o It is denoted by intersection minus (-).
1. Notation: R - S
Notation: R - S
Example: Using the above DEPOSITOR table and BORROW table
Input:
1. ∏ CUSTOMER_NAME (BORROW) - ∏ CUSTOMER_NAME (DEPOSITOR)
? CUSTOMER_NAME (BORROW
Output:
CUSTOMER_NAME
Jackson
Hayes
Willians
Curry
6. Cartesian product:
o The Cartesian product is used to combine each row in one table with each row in the
other table. It is also known as a cross product.
o It is denoted by X.
1. Notation: E X D
Notation: E X D
Example:
EMPLOYEE
EMP_ID EMP_NAME EMP_DEPT
1 Smith A
2 Harry C
3 John B
DEPARTMENT
DEPT_NO DEPT_NAME
A Marketing
B Sales
C Legal
Input:
1. EMPLOYEE X DEPARTMENT
EMPLOYEE X DEPARTMENT
Output:
EMP_ID EMP_NAME EMP_DEPT DEPT_NO DEPT_NAME
1 Smith A A Marketing
1 Smith A B Sales
1 Smith A C Legal
2 Harry C A Marketing
2 Harry C B Sales
2 Harry C C Legal
3 John B A Marketing
3 John B B Sales
3 John B C Legal
7. Rename Operation:
The rename operation is used to rename the output relation. It is denoted by rho (ρ).
Example: We can use the rename operator to rename STUDENT relation to STUDENT1.
1. ρ(STUDENT1, STUDENT)
Join Operations
A Join operation combines related tuples from different relations, if and only if a given join
condition is satisfied. It is denoted by ⋈.
Example:
EMPLOYEE
EMP_CODE EMP_NAME
101 Stephan
102 Jack
103 Harry
SALARY
EMP_CODE SALARY
101 50000
102 30000
103 25000
?
1. Operation: (EMPLOYEE ⋈ SALARY)
Operation: (EMPLOYEE SALARY)
Result:
EMP_CODE EMP_NAME SALARY
101 Stephan 50000
102 Jack 30000
103 Harry 25000
Types of Join operations:
1. Natural Join:
o A natural join is the set of tuples of all combinations in R and S that are equal on their
common attribute names.
o It is denoted by ⋈.
Example: Let's use the above EMPLOYEE table and SALARY table:
Input:
?
1. ∏EMP_NAME, SALARY (EMPLOYEE ⋈ SALARY)
? EMP_NAME, SALARY (EMPLOYEE SALARY)
Output:
EMP_NAME SALARY
Stephan 50000
Jack 30000
Harry 25000
2. Outer Join:
The outer join operation is an extension of the join operation. It is used to deal with missing
information.
Example:
EMPLOYEE
EMP_NAME STREET CITY
Ram Civil line Mumbai
Shyam Park street Kolkata
Ravi M.G. Street Delhi
Hari Nehru nagar Hyderabad
FACT_WORKERS
EMP_NAME BRANCH SALARY
Ram Infosys 10000
Shyam Wipro 20000
Kuber HCL 30000
Hari TCS 50000
Input:
?
1. (EMPLOYEE ⋈ FACT_WORKERS)
(EMPLOYEE FACT_WORKERS)
Output:
EMP_NAME STREET CITY BRANCH SALARY
Ram Civil line Mumbai Infosys 10000
Shyam Park street Kolkata Wipro 20000
Hari Nehru nagar Hyderabad TCS 50000
An outer join is basically of three types:
a. Left outer join
b. Right outer join
c. Full outer join
a. Left outer join:
o Left outer join contains the set of tuples of all combinations in R and S that are equal on
their common attribute names.
o In the left outer join, tuples in R have no matching tuples in S.
o It is denoted by ⟕.
Example: Using the above EMPLOYEE table and FACT_WORKERS table
Input:
?
1. EMPLOYEE ⟕ FACT_WORKERS
EMPLOYEE FACT_WORKERS
EMP_NAME STREET CITY BRANCH SALARY
Ram Civil line Mumbai Infosys 10000
Shyam Park street Kolkata Wipro 20000
Hari Nehru street Hyderabad TCS 50000
Ravi M.G. Street Delhi NULL NULL
b. Right outer join:
o Right outer join contains the set of tuples of all combinations in R and S that are equal
on their common attribute names.
o In right outer join, tuples in S have no matching tuples in R.
o It is denoted by ⟖.
Example: Using the above EMPLOYEE table and FACT_WORKERS Relation
Input:
?
1. EMPLOYEE ⟖ FACT_WORKERS
EMPLOYEE FACT_WORKERS
Output:
EMP_NAME BRANCH SALARY STREET CITY
Ram Infosys 10000 Civil line Mumbai
Shyam Wipro 20000 Park street Kolkata
Hari TCS 50000 Nehru street Hyderabad
Kuber HCL 30000 NULL NULL
c. Full outer join:
o Full outer join is like a left or right join except that it contains all rows from both tables.
o In full outer join, tuples in R that have no matching tuples in S and tuples in S that have
no matching tuples in R in their common attribute name.
o It is denoted by ⟗.
Example: Using the above EMPLOYEE table and FACT_WORKERS table
Input:
?
1. EMPLOYEE ⟗ FACT_WORKERS
EMPLOYEE FACT_WORKERS
Output:
EMP_NAME STREET CITY BRANCH SALARY
Ram Civil line Mumbai Infosys 10000
Shyam Park street Kolkata Wipro 20000
Hari Nehru street Hyderabad TCS 50000
Ravi M.G. Street Delhi NULL NULL
Kuber NULL NULL HCL 30000
3. Equi join:
It is also known as an inner join. It is the most common join. It is based on matched data as per
the equality condition. The equi join uses the comparison operator(=).
Example:
CUSTOMER RELATION
CLASS_ID NAME
1 John
2 Harry
3 Jackson
PRODUCT
PRODUCT_ID CITY
1 Delhi
2 Mumbai
3 Noida
Input:
?
1. CUSTOMER ⋈ PRODUCT
CUSTOMER PRODUCT
Output:
CLASS_ID NAME PRODUCT_ID CITY
1 John 1 Delhi
2 Harry 2 Mumbai
3 Harry 3 Noida