Oracle SQL Day 1
Oracle SQL Day 1
Oracle SQL Day 1
com
Oracle Day 1
Databases are the cornerstone of any Software Applications. You will need one or more
databases to develop almost all kind of Software Applications: Web, Enterprise,
Embedded Systems, Real-Time Systems, AI, ML, HPC, Blockchain, IoT, and many other
applications.
With the rise of Microservices, Cloud, Distributed Applications, Global Scaling, Semi-
Structured Data, Big Data, Fast Data, Low Latency Data: the traditional SQL databases
are now joined by various NoSQL. NewSQL, and Cloud databases.
There are a whopping 343 databases at present. Here I will list popular databases from
them
Oracle
MS SQL Server
Teradata
IBM DB2
Sybase
MySQL
PostgreSQL
Natezza
2. Oracle
When Edgar F. Codd’s published his revolutionary paper “A Relational Model of
Data for Large Shared Data Banks” (1970) on the Relational Database Management
System (RDBMS), it has completely changed the landscape of database Systems. The
paper particularly inspired a young Software Engineer Larry Ellison (current CTO of
Oracle Corporation). He later created the world’s first commercially available RDBMS
system Oracle in 1979. Since then, Oracle remained the leading commercial RDMBS
System and dominated the Unix and Linux Systems. Over the last 41 years, Oracle has
evolved with time and contributed to the RDBMS and the overall database Systems
innovations.
Currently, Oracle is the number one commercially supported database and one of the
widely used RDBMS overall. Its latest release (21.c) has added many innovative features
5 Key Features
Proprietory RDBMS.
Structured Data(JSON, XML), Spatial Data, and RDF Store. Offers multiple access
Traditional transactional workloads with structured (SQL) data, and when ACID
Data is extremely relational (e.g., Social Media), i.e., Graph like data.
Oracle As a Service
In the past, almost all databases were relational. They used a set data structure, which allowed
them to link information from different “tables”, using indexes. These data “buckets” could then
be linked through a “relationship”. SQL (Structured Query Language) is the language used for
this kind of databases. It provides commands to create, retrieve, update, and delete information
stored in the tables.
NoSQL, then, stands for “No Structured Query Language”. It is a non-relational type of
database. In this case, databases do not use any kind of relational enforcement. The architect of
the database determines what relationships, if any, are necessary for their data, and creates them.
ANSI
---------------------------------------------------
1.Numeric
int
decimal
float
double
number
number(6) 999999
number(8,2) 999999.99
number(2,2) 0.99
2. Character
char 2000
varchar 2000
varchar2 4000
3. Date
date
dd/mm/yyyy
4. LOB
CLOB -- GB
cust_id number(2,2),
cust_name char(10),
cust_name2 varchar(10)
);
desc test;
-------------------------------------------------------------------
SQL
create
alter
rename
truncate
drop
Insert
update
delete
Merge
select
commit
rollback
savepoint
Grant
Revoke
--------------------------------------------------------------------
column_1 data_type,
column_2 data_type,
column_3 data_type,
column_n data_type
);
cust_id number(6),
cust_name varchar2(30),
mobile_no number(10),
dob date,
city varchar2(100),
email_id varchar2(100)
);
(column1,column2,column3)
values
(value1,value2,value3);
cust_id number(6),
cust_name varchar2(30),
dob date,
mobile number(10),
address varchar2(100)
);
(CUST_ID,cust_name,dob,mobile,address)
values
(100000,'Arun',to_date('09/12/1992','mm/dd/yyyy'),9090909090,'Chennai');
rollback;
commit;
values
(100001,'Kannan',to_date('09/11/2000','mm/dd/yyyy'),8132437493,'Chennai');
values
(100002,'Radha',to_date('09/24/2012','mm/dd/yyyy'),1348374989);
(CUST_ID,cust_name,dob,mobile)
values
(100002,'Radha',to_date('09/24/2012','mm/dd/yyyy'),1348374989);
commit;
update table_name
set column_name=value
where condition;
update customer
set address='Hydrabad';
rollback;
update customer
set address='Hydrabad'
where cust_id=100002;
commit;
-- Add a column
--drop a column
-- Rename a table
-- rename a column
--------------------------------------------------------------------
1. bkp a table
---------------------------------------------------------------------