SlideShare uma empresa Scribd logo
1 de 45
Baixar para ler offline
Oracle Database, SQL
Day 1
Trainers:
Gurpreet Singh
Oracle Database, SQL2
Day 1 Agenda
3 Oracle Database, SQL
EVOLUTION OF DATABASE
4 Oracle Database, SQL
EVOLUTION OF DATABASE
5 Oracle Database, SQL
How to manage my data?
• How to search?
• How to edit?
• How to delete?
Various access methods , e.g., sequential, indexed,
random
• Requires extensive programming in third-generation language such as COBOL,
BASIC.
• Duplication of data
• Weak security.
1968
EVOLUTION OF DATABASE
6 Oracle Database, SQL
Earlier,
punched cards technology
was used to store the data
EVOLUTION OF DATABASE
7 Oracle Database, SQL
1968-1980
IBM Rockwell+
=
EVOLUTION OF DATABASE
8 Oracle Database, SQL
Early 1960’s
EVOLUTION OF DATABASE
9 Oracle Database, SQL
1970-Present
Edgar Frank "Ted" Codd
Father of Database Management Systems
EVOLUTION OF DATABASE
10 Oracle Database, SQL
1970-Present
Era of RDBMS
The relational database model was
conceived by E. F. Codd in 1970. It can be
defined using the following two
terminologies:
• Instance – a table with rows or
columns.
• Schema – specifies the structure (name
of relation, name and type of each
column)
EVOLUTION OF DATABASE
11 Oracle Database, SQL
1970-Present
Rule 0: Foundation rule
Any relational database management system that is propounded to be
RDBMS or advocated to be a RDBMS should be able to manage the
stored data in its entirety through its relational capabilities.
Rule 1: Rule of Information
Relational Databases should store the data in the form of relations.
Tables are relations in Relational Database Management Systems. Be
it any user defined data or meta-data, it is important to store the
value as an entity in the table cells.
Rule 2: Rule of Guaranteed Access
The use of pointers to access data logically is strictly forbidden. Every
data entity which is atomic in nature should be accessed logically by
using a right combination of the name of table, primary key
represented by a specific row value and column name represented by
attribute value.
EVOLUTION OF DATABASE
12 Oracle Database, SQL
1970-Present
Rule 3: Rule of Systematic Null Value Support
Null values are completely supported in relational databases. They should be uniformly
considered as ‘missing information’. Null values are independent of any data type. They
should not be mistaken for blanks or zeroes or empty strings. Null values can also be
interpreted as ‘inapplicable data’ or ‘unknown information.’
Rule 4: Rule of Active and online relational Catalog
In the Database Management Systems lexicon, ‘metadata’ is the data about the database or
the data about the data. The active online catalog that stores the metadata is called ‘Data
dictionary’. The so called data dictionary is accessible only by authored users who have the
required privileges and the query languages used for accessing the database should be used
for accessing the data of data dictionary.
Rule 5: Rule of Comprehensive Data Sub-language
A single robust language should be able to define integrity constraints, views, data
manipulations, transactions and authorizations. If the database allows access to the
aforementioned ones, it is violating this rule.
EVOLUTION OF DATABASE
13 Oracle Database, SQL
1970-Present
Rule 6: Rule of Updating Views
Views should reflect the updates of their respective base tables and vice versa. A view is a
logical table which shows restricted data. Views generally make the data readable but not
modifiable. Views help in data abstraction.
Rule 7: Rule of Set level insertion, update and deletion
A single operation should be sufficient to retrieve, insert, update and delete the data.
Rule 8: Rule of Physical Data Independence
Batch and end user operations are logically separated from physical storage and respective
access methods.
Rule 9: Rule of Logical Data Independence
Batch and end users can change the database schema without having to recreate it or recreate
the applications built upon it.
EVOLUTION OF DATABASE
14 Oracle Database, SQL
1970-Present
Rule 10: Rule of Integrity Independence
Integrity constraints should be available and stored as metadata in data dictionary and not in
the application programs.
Rule 11: Rule of Distribution Independence
The Data Manipulation Language of the relational system should not be concerned about the
physical data storage and no alterations should be required if the physical data is centralized or
distributed.
Rule 12: Rule of Non Subversion
Any row should obey the security and integrity constraints imposed. No special privileges are
applicable.
SQL
Oracle Database, SQL15
• SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to
communicate with a database.
• According to ANSI (American National Standards Institute), it is the standard language for
relational database management systems.
• SQL statements are used to perform tasks such as update data on a database, or retrieve data
from a database.
• Some common relational database management systems that use SQL are: Oracle, Sybase,
Microsoft SQL Server, Access, Ingres, etc.
• Although most database systems use SQL, most of them also have their own additional
proprietary extensions that are usually only used on their system. However, the standard SQL
commands such as "Select", "Insert", "Update", "Delete", "Create", and "Drop" can be used to
accomplish almost everything that one needs to do with a database
Oracle Database, SQL16
DDL DML DQL
DCL TCL DAL
Languages
• DDL (Data Definition Language)
• DML (Data Manipulation Language)
• DQL (Data Query Language)
• DCL (Data Control Language)
• TCL(Transactional control Language)
• DAL (Data Administration Language)
Oracle Database, SQL17
DDL
Data Definition Language, DDL , is the part of SQL that allows a
database user to create and restructure database objects.
 CREATE TABLE
 ALTER TABLE
 DROP TABLE
 CREATE INDEX
 DROP INDEX
 CREATE VIEW
 DROP VIEW
Oracle Database, SQL18
CREATE TABLE
The basic syntax of the CREATE TABLE statement is as follows −
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
.....
columnN datatype
);
CREATE TABLE CUSTOMERS(
ID NUMBER,
NAME VARCHAR (20),
AGE NUMBER,
ADDRESS CHAR (25) ,
SALARY NUMBER,
);
Oracle Database, SQL19
CREATE TABLE
To create table using another table:
CREATE TABLE new_table_name
AS
SELECT [ column1, column2...columnN ]
FROM existing_table_name
[ WHERE ]
;
CREATE TABLE SALARY
AS
SELECT ID, SALARY
FROM CUSTOMERS;
Oracle Database, SQL20
ALTER TABLE
The basic syntax of an ALTER TABLE command to add a New Column:
ALTER TABLE table_name
ADD
column_name datatype;
ALTER TABLE Customers
ADD
Mobile varchar2(10);
To DROP COLUMN in an existing table:
ALTER TABLE Customers
DROP COLUMN
Mobile;
ALTER TABLE table_name
DROP COLUMN
column_name ;
Oracle Database, SQL21
ALTER TABLE
To change the DATA TYPE of a column in a table:
ALTER TABLE table_name
MODIFY
column_name new_datatype;
ALTER TABLE Customers
MODIFY
Name varchar2(30);
To rename column name in a table:
ALTER TABLE Customers
RENAME COLUMN
Name TO FullName;
ALTER TABLE table_name
RENAME COLUMN
Old_Column_Name TO New_Column_Name;
Oracle Database, SQL22
ALTER TABLE
To RENAME TABLE:
ALTER TABLE table_name
RENAME TO
New_Table_Name;
ALTER TABLE Customers
RENAME TO
CustomerDetails;
Oracle Database, SQL23
DROP TABLE
To DROP TABLE:
DROP TABLE table_name;
DROP TABLE Customers;
Oracle Database, SQL24
CREATE INDEX
Indexes are used to retrieve data from the database very fast. The users
cannot see the indexes, they are just used to speed up searches/queries.
Note: Updating a table with indexes takes more time than updating a table
without (because the indexes also need an update). So, only create indexes on
columns that will be frequently searched against.
CREATE UNIQUE INDEX CustomerIDIndex
ON
CustomerDetails (ID);
CREATE [UNIQUE] INDEX TableName
ON
Table Name (Column1, Column2);
Oracle Database, SQL25
DROP INDEX
To drop Index:
DROP INDEX CustomerIDIndex;
DROP INDEX Indexname;
Oracle Database, SQL26
CREATE VIEW
A view is nothing more than a SQL statement that is stored in the database
with an associated name. A view is actually a composition of a table in the
form of a predefined SQL query.
A view can contain all rows of a table or select rows from a table. A view
can be created from one or many tables which depends on the written SQL query
to create a view.
CREATE VIEW IndianCustomers AS
SELECT *
FROM CustomerDetails
WHERE Address LIKE ‘%India%’;
CREATE VIEW View_Name AS
SELECT column1, column2,…., coulmnN
FROM Tablename
[WHERE];
Oracle Database, SQL27
DROP VIEW
To drop View:
DROP VIEW IndianCustomers;
DROP VIEW Viewname;
Oracle Database, SQL28
DML
Data Manipulation Language, DML , is the part of SQL used to manipulate data
within objects of a relational database.
 INSERT
 UPDATE
 DELETE
Oracle Database, SQL29
INSERT
The basic syntax of INSERT:
INSERT INTO Customers VALUES (101, ‘Ramesh’, 23,’New Delhi, India’,10000);
INSERT INTO Customers (ID, NAME, AGE, ADDRESS, SALARY)
VALUES (101, ‘John’, 23,’New Street, UK’,10000);
INSERT INTO TABLE_NAME (column1, column2, column3,...columnN)
SELECT column1, column2, column3 FROM tablename;
INSERT INTO TABLE_NAME (column1, column2, column3,...columnN)
VALUES (value1, value2, value3,...valueN);
INSERT INTO EMP_HISTORY
SELECT EMPLOYEE_ID, EMPLOYEE_NAME, SALARY, DEPARTMENT_ID
FROM employees;
Oracle Database, SQL30
DELETE
The basic syntax of DELETE:
DELETE FROM Customers WHERE ID=100;
DELETE FROM Customers;
DELETE FROM TABLE_NAME [WHERE];
Oracle Database, SQL31
UPDATE
The basic syntax of UPDATE:
UPDATE Customers SET salary =20000
WHERE ID=100;
UPDATE TableName
SET
Column1=Value1,
Column1=Value1,
…,
ColumnN=ValueN
[WHERE];
Oracle Database, SQL32
DQL/DRL
Data Query Language (DQL) or Data Retrieval Language (DRL) is the most concentrated focus of SQL for
modern relational database users
 SELECT
The SQL SELECT statement is used to fetch the data from a database table which returns this data in the
form of a result table. These result tables are called result-sets.
The basic syntax of the SELECT statement is as follows −
SELECT ID, Name,Salary From Customers;
SELECT column1, column2, columnN FROM table_name;
Oracle Database, SQL33
DCL
It allow you to control access to data within the database.
DCL commands are normally used to create objects related to user access and
also control the distribution of privileges among users.
 GRANT
 REVOKE
Oracle Database, SQL34
GRANT
Use the GRANT statement to give privileges to a specific user or role, or to
all users, to perform actions on database objects. You can also use the GRANT
statement to grant a role to a user, to PUBLIC, or to another role.
The following types of privileges can be granted:
 Delete data from a specific table.
 Insert data into a specific table.
 Update data in a table or in a subset of columns in a table.
 Select data from a table, view, or a subset of columns in a table.
 Create a trigger on a table.
 Run a specified function or procedure.
The syntax that you use for the GRANT statement depends on whether you are granting privileges to a
schema object or granting a role
Oracle Database, SQL35
GRANT
Privilege is the permission name, which is granted to the user. It may be SELECT, INSERT, UPDATE, DELETE,
EXECUTE, ALL and many others, on a database object.
Privileges are of two types
System privilege – Schema level privilege which is granted by DBA to the users is known as System
privilege. They include privilege to issue commands like CREATE (cluster, database link, directory, job,
procedure, role, synonym, table, trigger, tablespace, types, view, database), ALTER, DROP, DEBUG,
FLASHBACK, LOCK, CONNECT, RESOURCE etc. Please note that these privileges are not limited to an
object access, but applicable at User level.
Object privilege – Object level privilege can be granted from object owning user (Grantor) to other user
(GRANTEE). Grantor permits access on a specific object and grantee enjoys the access privilege only on
the database object concerned. It may be DELETE, SELECT, INSERT, UPDATE, EXECUTE, INDEX, READ,
WRITE, ALTER (table, sequence).
Oracle Database, SQL36
GRANT
ADMIN option allows the Grantee to grant a System privilege to other user. Only DBA or user with GRANT
ANY PRIVILEGE system privilege can grant a system privilege to other users. Users which possess a system
privilege with ADMIN option can pass only that system privilege.
GRANT option allows the Grantor (owner) to grant an Object privilege on an object to other user. To
grant an object privilege, grantor must satisfy any of the below criteria:
1. He must own the object
2. He must have access on object with GRANT OPTION from the owner of the object
3. He must have GRANT ANY OBJECT PRIVILEGE system privilege and an object privilege on the object
Oracle Database, SQL37
GRANT
Syntax for objects
GRANT [privilege]
ON [object]
TO {user |PUBLIC |role}
[WITH ADMIN | GRANT OPTION];
GRANT SELECT ON T1 TO U2;
GRANT CREATE INDEX TO U1 WITH ADMIN OPTION;
Syntax for roles
GRANT roleName [ {, roleName }* ] TO grantees
Oracle Database, SQL38
REVOKE
REVOKE command is used to revoke an existing privilege from a user. It can revoke a system privilege,
object privilege or a role from a user. Only DBA or a user with ADMIN OPTION can revoke system
privilege.
REVOKE [privilege]
ON [object]
FROM {USER |PUBLIC | ROLE}
REVOKE SELECT ON T1 FROM U1;
Oracle Database, SQL39
DAL
Data administration commands allow the user to perform audits and perform
analyses on operations within the database.
They can also be used to help analyze system performance.
START AUDIT
STOP AUDIT
Oracle Database, SQL40
TCL
It allow the user to manage database transactions.
COMMIT Saves database transactions
ROLLBACK Undoes database transactions
SAVEPOINT Creates points within groups of transactions in which to ROLLBACK
SET TRANSACTION Places a name on a transaction
SET TRANSACTION READ ONLY NAME 'T1';
Oracle Database, SQL41
Constraints
Constraints are the rules enforced on the data columns of a table. These are used to limit the type of data that
can go into a table. This ensures the accuracy and reliability of the data in the database.
Constraints can be divided into following two types:
• Column level constraints : limits only column data
• Table level constraints : limits whole table data
1. NOT NULL
2. UNIQUE
3. PRIMARY KEY
4. FOREIGN KEY
5. CHECK
6. DEFAULT
Oracle Database, SQL42
NOT NULL
REVOKE command is used to revoke an existing privilege from a user. It can revoke a system privilege,
object privilege or a role from a user. Only DBA or a user with ADMIN OPTION can revoke system
privilege.
REVOKE [privilege]
ON [object]
FROM {USER |PUBLIC | ROLE}
REVOKE SELECT ON T1 FROM U1;
Oracle Database, SQL43
NOT NULL constraint restricts a column from having a NULL value. Once NOT NULL constraint is applied to a
column, you cannot pass a null value to that column. It enforces a column to contain a proper value. One
important point to note about NOT NULL constraint is that it cannot be defined at table level.
CONTACTS
44
Gurpreet Singh
Senior Software Engineer
CUG. 2142
M. +91-9803723925
Gurpreet.singh2@soprasteria.com
Oracle Database, SQL
Oracle Database, SQL45

Mais conteúdo relacionado

Mais procurados

Generating Code with Oracle SQL Developer Data Modeler
Generating Code with Oracle SQL Developer Data ModelerGenerating Code with Oracle SQL Developer Data Modeler
Generating Code with Oracle SQL Developer Data ModelerRob van den Berg
 
OBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - TutorialOBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - Tutorialonlinetrainingplacements
 
Oracle 11G Development Training noida Delhi NCR
Oracle 11G Development Training noida Delhi NCROracle 11G Development Training noida Delhi NCR
Oracle 11G Development Training noida Delhi NCRShri Prakash Pandey
 
A introduction to oracle data integrator
A introduction to oracle data integratorA introduction to oracle data integrator
A introduction to oracle data integratorchkamal
 
Oracle Form material
Oracle Form materialOracle Form material
Oracle Form materialRajesh Ch
 
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!Amanda Lam
 
Sql tutorial-Structured query language
Sql tutorial-Structured query languageSql tutorial-Structured query language
Sql tutorial-Structured query languageMayank Bansal
 
Database Systems - Introduction to SQL (Chapter 3/1)
Database Systems - Introduction to SQL (Chapter 3/1)Database Systems - Introduction to SQL (Chapter 3/1)
Database Systems - Introduction to SQL (Chapter 3/1)Vidyasagar Mundroy
 
4) databases
4) databases4) databases
4) databasestechbed
 
Oracle Sql Developer Data Modeler 3 3 new features
Oracle Sql Developer Data Modeler 3 3 new featuresOracle Sql Developer Data Modeler 3 3 new features
Oracle Sql Developer Data Modeler 3 3 new featuresPhilip Stoyanov
 
Enterprise Spring
Enterprise SpringEnterprise Spring
Enterprise SpringEmprovise
 

Mais procurados (20)

treeview
treeviewtreeview
treeview
 
Oracle reports
Oracle reportsOracle reports
Oracle reports
 
Generating Code with Oracle SQL Developer Data Modeler
Generating Code with Oracle SQL Developer Data ModelerGenerating Code with Oracle SQL Developer Data Modeler
Generating Code with Oracle SQL Developer Data Modeler
 
OBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - TutorialOBIEE publisher with Report creation - Tutorial
OBIEE publisher with Report creation - Tutorial
 
Intro
IntroIntro
Intro
 
Oracle 11G Development Training noida Delhi NCR
Oracle 11G Development Training noida Delhi NCROracle 11G Development Training noida Delhi NCR
Oracle 11G Development Training noida Delhi NCR
 
A introduction to oracle data integrator
A introduction to oracle data integratorA introduction to oracle data integrator
A introduction to oracle data integrator
 
Oracle Form material
Oracle Form materialOracle Form material
Oracle Form material
 
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
Waiting too long for Excel's VLOOKUP? Use SQLite for simple data analysis!
 
Sql tutorial-Structured query language
Sql tutorial-Structured query languageSql tutorial-Structured query language
Sql tutorial-Structured query language
 
Database Systems - Introduction to SQL (Chapter 3/1)
Database Systems - Introduction to SQL (Chapter 3/1)Database Systems - Introduction to SQL (Chapter 3/1)
Database Systems - Introduction to SQL (Chapter 3/1)
 
4) databases
4) databases4) databases
4) databases
 
Oracle Sql Developer Data Modeler 3 3 new features
Oracle Sql Developer Data Modeler 3 3 new featuresOracle Sql Developer Data Modeler 3 3 new features
Oracle Sql Developer Data Modeler 3 3 new features
 
Jdbc
JdbcJdbc
Jdbc
 
Oracle
OracleOracle
Oracle
 
Enterprise Spring
Enterprise SpringEnterprise Spring
Enterprise Spring
 
Database Objects
Database ObjectsDatabase Objects
Database Objects
 
Handy annotations-within-oracle-10g
Handy annotations-within-oracle-10gHandy annotations-within-oracle-10g
Handy annotations-within-oracle-10g
 
SQL
SQLSQL
SQL
 
Fg d
Fg dFg d
Fg d
 

Semelhante a Oracle SQL Part1

SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredDanish Mehraj
 
DEE 431 Introduction to Mysql Slide 3
DEE 431 Introduction to Mysql Slide 3DEE 431 Introduction to Mysql Slide 3
DEE 431 Introduction to Mysql Slide 3YOGESH SINGH
 
SQL Training Institute in Ambala ! Batra Computer Centre
SQL Training Institute in Ambala ! Batra Computer CentreSQL Training Institute in Ambala ! Batra Computer Centre
SQL Training Institute in Ambala ! Batra Computer Centrejatin batra
 
Introduction to SQL.pptx
Introduction to SQL.pptxIntroduction to SQL.pptx
Introduction to SQL.pptxInduVerma40
 
Introduction to Oracle Database
Introduction to Oracle DatabaseIntroduction to Oracle Database
Introduction to Oracle Databasepuja_dhar
 
Oracle DBA Tutorial for Beginners -Oracle training institute in bangalore
Oracle DBA Tutorial for Beginners -Oracle training institute in bangaloreOracle DBA Tutorial for Beginners -Oracle training institute in bangalore
Oracle DBA Tutorial for Beginners -Oracle training institute in bangaloreTIB Academy
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytWrushabhShirsat3
 
What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?CPD INDIA
 

Semelhante a Oracle SQL Part1 (20)

SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
 
DEE 431 Introduction to Mysql Slide 3
DEE 431 Introduction to Mysql Slide 3DEE 431 Introduction to Mysql Slide 3
DEE 431 Introduction to Mysql Slide 3
 
SQL Training Institute in Ambala ! Batra Computer Centre
SQL Training Institute in Ambala ! Batra Computer CentreSQL Training Institute in Ambala ! Batra Computer Centre
SQL Training Institute in Ambala ! Batra Computer Centre
 
Reviewing SQL Concepts
Reviewing SQL ConceptsReviewing SQL Concepts
Reviewing SQL Concepts
 
Introduction to SQL.pptx
Introduction to SQL.pptxIntroduction to SQL.pptx
Introduction to SQL.pptx
 
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
 
Sql in dbms
Sql in dbmsSql in dbms
Sql in dbms
 
Introduction to Oracle Database
Introduction to Oracle DatabaseIntroduction to Oracle Database
Introduction to Oracle Database
 
lovely
lovelylovely
lovely
 
Oracle DBA Tutorial for Beginners -Oracle training institute in bangalore
Oracle DBA Tutorial for Beginners -Oracle training institute in bangaloreOracle DBA Tutorial for Beginners -Oracle training institute in bangalore
Oracle DBA Tutorial for Beginners -Oracle training institute in bangalore
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
Oracle Introduction
Oracle Introduction Oracle Introduction
Oracle Introduction
 
Dbmsunit v
Dbmsunit vDbmsunit v
Dbmsunit v
 
Sqlite
SqliteSqlite
Sqlite
 
MySQL intro
MySQL introMySQL intro
MySQL intro
 
MySQL intro
MySQL introMySQL intro
MySQL intro
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
 
Data base
Data baseData base
Data base
 
What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?
 

Mais de Gurpreet singh

Understanding Flex Fields with Accounting Flexfields(Chart of Accounts) in O...
Understanding Flex Fields with  Accounting Flexfields(Chart of Accounts) in O...Understanding Flex Fields with  Accounting Flexfields(Chart of Accounts) in O...
Understanding Flex Fields with Accounting Flexfields(Chart of Accounts) in O...Gurpreet singh
 
Generics and collections in Java
Generics and collections in JavaGenerics and collections in Java
Generics and collections in JavaGurpreet singh
 
IO Streams, Serialization, de-serialization, autoboxing
IO Streams, Serialization, de-serialization, autoboxingIO Streams, Serialization, de-serialization, autoboxing
IO Streams, Serialization, de-serialization, autoboxingGurpreet singh
 
Creating business group in oracle apps
Creating business group in oracle appsCreating business group in oracle apps
Creating business group in oracle appsGurpreet singh
 
Defing locations in Oracle Apps
Defing locations in Oracle AppsDefing locations in Oracle Apps
Defing locations in Oracle AppsGurpreet singh
 
Assigning role AME_BUS_ANALYST
Assigning role AME_BUS_ANALYSTAssigning role AME_BUS_ANALYST
Assigning role AME_BUS_ANALYSTGurpreet singh
 
Introduction to Data Flow Diagram (DFD)
Introduction to Data Flow Diagram (DFD)Introduction to Data Flow Diagram (DFD)
Introduction to Data Flow Diagram (DFD)Gurpreet singh
 
Ingenium test(Exam Management System) Project Presentation (Full)
Ingenium test(Exam Management System) Project Presentation (Full)Ingenium test(Exam Management System) Project Presentation (Full)
Ingenium test(Exam Management System) Project Presentation (Full)Gurpreet singh
 
Computer Graphics Notes
Computer Graphics NotesComputer Graphics Notes
Computer Graphics NotesGurpreet singh
 

Mais de Gurpreet singh (20)

Why Messaging system?
Why Messaging system?Why Messaging system?
Why Messaging system?
 
Understanding Flex Fields with Accounting Flexfields(Chart of Accounts) in O...
Understanding Flex Fields with  Accounting Flexfields(Chart of Accounts) in O...Understanding Flex Fields with  Accounting Flexfields(Chart of Accounts) in O...
Understanding Flex Fields with Accounting Flexfields(Chart of Accounts) in O...
 
Java Servlet part 3
Java Servlet part 3Java Servlet part 3
Java Servlet part 3
 
Generics and collections in Java
Generics and collections in JavaGenerics and collections in Java
Generics and collections in Java
 
IO Streams, Serialization, de-serialization, autoboxing
IO Streams, Serialization, de-serialization, autoboxingIO Streams, Serialization, de-serialization, autoboxing
IO Streams, Serialization, de-serialization, autoboxing
 
Java Servlets Part 2
Java Servlets Part 2Java Servlets Part 2
Java Servlets Part 2
 
Creating business group in oracle apps
Creating business group in oracle appsCreating business group in oracle apps
Creating business group in oracle apps
 
Defing locations in Oracle Apps
Defing locations in Oracle AppsDefing locations in Oracle Apps
Defing locations in Oracle Apps
 
Assigning role AME_BUS_ANALYST
Assigning role AME_BUS_ANALYSTAssigning role AME_BUS_ANALYST
Assigning role AME_BUS_ANALYST
 
PL/SQL Part 5
PL/SQL Part 5PL/SQL Part 5
PL/SQL Part 5
 
PL/SQL Part 3
PL/SQL Part 3PL/SQL Part 3
PL/SQL Part 3
 
PL/SQL Part 2
PL/SQL Part 2PL/SQL Part 2
PL/SQL Part 2
 
PL/SQL Part 1
PL/SQL Part 1PL/SQL Part 1
PL/SQL Part 1
 
Introduction to Data Flow Diagram (DFD)
Introduction to Data Flow Diagram (DFD)Introduction to Data Flow Diagram (DFD)
Introduction to Data Flow Diagram (DFD)
 
Ingenium test(Exam Management System) Project Presentation (Full)
Ingenium test(Exam Management System) Project Presentation (Full)Ingenium test(Exam Management System) Project Presentation (Full)
Ingenium test(Exam Management System) Project Presentation (Full)
 
Computer Graphics Notes
Computer Graphics NotesComputer Graphics Notes
Computer Graphics Notes
 
Learn Java Part 11
Learn Java Part 11Learn Java Part 11
Learn Java Part 11
 
Learn Java Part 11
Learn Java Part 11Learn Java Part 11
Learn Java Part 11
 
Learn Java Part 10
Learn Java Part 10Learn Java Part 10
Learn Java Part 10
 
Learn Java Part 9
Learn Java Part 9Learn Java Part 9
Learn Java Part 9
 

Último

Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 

Último (20)

Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Oracle SQL Part1

  • 1. Oracle Database, SQL Day 1 Trainers: Gurpreet Singh
  • 4. EVOLUTION OF DATABASE 4 Oracle Database, SQL
  • 5. EVOLUTION OF DATABASE 5 Oracle Database, SQL How to manage my data? • How to search? • How to edit? • How to delete? Various access methods , e.g., sequential, indexed, random • Requires extensive programming in third-generation language such as COBOL, BASIC. • Duplication of data • Weak security. 1968
  • 6. EVOLUTION OF DATABASE 6 Oracle Database, SQL Earlier, punched cards technology was used to store the data
  • 7. EVOLUTION OF DATABASE 7 Oracle Database, SQL 1968-1980 IBM Rockwell+ =
  • 8. EVOLUTION OF DATABASE 8 Oracle Database, SQL Early 1960’s
  • 9. EVOLUTION OF DATABASE 9 Oracle Database, SQL 1970-Present Edgar Frank "Ted" Codd Father of Database Management Systems
  • 10. EVOLUTION OF DATABASE 10 Oracle Database, SQL 1970-Present Era of RDBMS The relational database model was conceived by E. F. Codd in 1970. It can be defined using the following two terminologies: • Instance – a table with rows or columns. • Schema – specifies the structure (name of relation, name and type of each column)
  • 11. EVOLUTION OF DATABASE 11 Oracle Database, SQL 1970-Present Rule 0: Foundation rule Any relational database management system that is propounded to be RDBMS or advocated to be a RDBMS should be able to manage the stored data in its entirety through its relational capabilities. Rule 1: Rule of Information Relational Databases should store the data in the form of relations. Tables are relations in Relational Database Management Systems. Be it any user defined data or meta-data, it is important to store the value as an entity in the table cells. Rule 2: Rule of Guaranteed Access The use of pointers to access data logically is strictly forbidden. Every data entity which is atomic in nature should be accessed logically by using a right combination of the name of table, primary key represented by a specific row value and column name represented by attribute value.
  • 12. EVOLUTION OF DATABASE 12 Oracle Database, SQL 1970-Present Rule 3: Rule of Systematic Null Value Support Null values are completely supported in relational databases. They should be uniformly considered as ‘missing information’. Null values are independent of any data type. They should not be mistaken for blanks or zeroes or empty strings. Null values can also be interpreted as ‘inapplicable data’ or ‘unknown information.’ Rule 4: Rule of Active and online relational Catalog In the Database Management Systems lexicon, ‘metadata’ is the data about the database or the data about the data. The active online catalog that stores the metadata is called ‘Data dictionary’. The so called data dictionary is accessible only by authored users who have the required privileges and the query languages used for accessing the database should be used for accessing the data of data dictionary. Rule 5: Rule of Comprehensive Data Sub-language A single robust language should be able to define integrity constraints, views, data manipulations, transactions and authorizations. If the database allows access to the aforementioned ones, it is violating this rule.
  • 13. EVOLUTION OF DATABASE 13 Oracle Database, SQL 1970-Present Rule 6: Rule of Updating Views Views should reflect the updates of their respective base tables and vice versa. A view is a logical table which shows restricted data. Views generally make the data readable but not modifiable. Views help in data abstraction. Rule 7: Rule of Set level insertion, update and deletion A single operation should be sufficient to retrieve, insert, update and delete the data. Rule 8: Rule of Physical Data Independence Batch and end user operations are logically separated from physical storage and respective access methods. Rule 9: Rule of Logical Data Independence Batch and end users can change the database schema without having to recreate it or recreate the applications built upon it.
  • 14. EVOLUTION OF DATABASE 14 Oracle Database, SQL 1970-Present Rule 10: Rule of Integrity Independence Integrity constraints should be available and stored as metadata in data dictionary and not in the application programs. Rule 11: Rule of Distribution Independence The Data Manipulation Language of the relational system should not be concerned about the physical data storage and no alterations should be required if the physical data is centralized or distributed. Rule 12: Rule of Non Subversion Any row should obey the security and integrity constraints imposed. No special privileges are applicable.
  • 15. SQL Oracle Database, SQL15 • SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database. • According to ANSI (American National Standards Institute), it is the standard language for relational database management systems. • SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database. • Some common relational database management systems that use SQL are: Oracle, Sybase, Microsoft SQL Server, Access, Ingres, etc. • Although most database systems use SQL, most of them also have their own additional proprietary extensions that are usually only used on their system. However, the standard SQL commands such as "Select", "Insert", "Update", "Delete", "Create", and "Drop" can be used to accomplish almost everything that one needs to do with a database
  • 16. Oracle Database, SQL16 DDL DML DQL DCL TCL DAL Languages • DDL (Data Definition Language) • DML (Data Manipulation Language) • DQL (Data Query Language) • DCL (Data Control Language) • TCL(Transactional control Language) • DAL (Data Administration Language)
  • 17. Oracle Database, SQL17 DDL Data Definition Language, DDL , is the part of SQL that allows a database user to create and restructure database objects.  CREATE TABLE  ALTER TABLE  DROP TABLE  CREATE INDEX  DROP INDEX  CREATE VIEW  DROP VIEW
  • 18. Oracle Database, SQL18 CREATE TABLE The basic syntax of the CREATE TABLE statement is as follows − CREATE TABLE table_name( column1 datatype, column2 datatype, column3 datatype, ..... columnN datatype ); CREATE TABLE CUSTOMERS( ID NUMBER, NAME VARCHAR (20), AGE NUMBER, ADDRESS CHAR (25) , SALARY NUMBER, );
  • 19. Oracle Database, SQL19 CREATE TABLE To create table using another table: CREATE TABLE new_table_name AS SELECT [ column1, column2...columnN ] FROM existing_table_name [ WHERE ] ; CREATE TABLE SALARY AS SELECT ID, SALARY FROM CUSTOMERS;
  • 20. Oracle Database, SQL20 ALTER TABLE The basic syntax of an ALTER TABLE command to add a New Column: ALTER TABLE table_name ADD column_name datatype; ALTER TABLE Customers ADD Mobile varchar2(10); To DROP COLUMN in an existing table: ALTER TABLE Customers DROP COLUMN Mobile; ALTER TABLE table_name DROP COLUMN column_name ;
  • 21. Oracle Database, SQL21 ALTER TABLE To change the DATA TYPE of a column in a table: ALTER TABLE table_name MODIFY column_name new_datatype; ALTER TABLE Customers MODIFY Name varchar2(30); To rename column name in a table: ALTER TABLE Customers RENAME COLUMN Name TO FullName; ALTER TABLE table_name RENAME COLUMN Old_Column_Name TO New_Column_Name;
  • 22. Oracle Database, SQL22 ALTER TABLE To RENAME TABLE: ALTER TABLE table_name RENAME TO New_Table_Name; ALTER TABLE Customers RENAME TO CustomerDetails;
  • 23. Oracle Database, SQL23 DROP TABLE To DROP TABLE: DROP TABLE table_name; DROP TABLE Customers;
  • 24. Oracle Database, SQL24 CREATE INDEX Indexes are used to retrieve data from the database very fast. The users cannot see the indexes, they are just used to speed up searches/queries. Note: Updating a table with indexes takes more time than updating a table without (because the indexes also need an update). So, only create indexes on columns that will be frequently searched against. CREATE UNIQUE INDEX CustomerIDIndex ON CustomerDetails (ID); CREATE [UNIQUE] INDEX TableName ON Table Name (Column1, Column2);
  • 25. Oracle Database, SQL25 DROP INDEX To drop Index: DROP INDEX CustomerIDIndex; DROP INDEX Indexname;
  • 26. Oracle Database, SQL26 CREATE VIEW A view is nothing more than a SQL statement that is stored in the database with an associated name. A view is actually a composition of a table in the form of a predefined SQL query. A view can contain all rows of a table or select rows from a table. A view can be created from one or many tables which depends on the written SQL query to create a view. CREATE VIEW IndianCustomers AS SELECT * FROM CustomerDetails WHERE Address LIKE ‘%India%’; CREATE VIEW View_Name AS SELECT column1, column2,…., coulmnN FROM Tablename [WHERE];
  • 27. Oracle Database, SQL27 DROP VIEW To drop View: DROP VIEW IndianCustomers; DROP VIEW Viewname;
  • 28. Oracle Database, SQL28 DML Data Manipulation Language, DML , is the part of SQL used to manipulate data within objects of a relational database.  INSERT  UPDATE  DELETE
  • 29. Oracle Database, SQL29 INSERT The basic syntax of INSERT: INSERT INTO Customers VALUES (101, ‘Ramesh’, 23,’New Delhi, India’,10000); INSERT INTO Customers (ID, NAME, AGE, ADDRESS, SALARY) VALUES (101, ‘John’, 23,’New Street, UK’,10000); INSERT INTO TABLE_NAME (column1, column2, column3,...columnN) SELECT column1, column2, column3 FROM tablename; INSERT INTO TABLE_NAME (column1, column2, column3,...columnN) VALUES (value1, value2, value3,...valueN); INSERT INTO EMP_HISTORY SELECT EMPLOYEE_ID, EMPLOYEE_NAME, SALARY, DEPARTMENT_ID FROM employees;
  • 30. Oracle Database, SQL30 DELETE The basic syntax of DELETE: DELETE FROM Customers WHERE ID=100; DELETE FROM Customers; DELETE FROM TABLE_NAME [WHERE];
  • 31. Oracle Database, SQL31 UPDATE The basic syntax of UPDATE: UPDATE Customers SET salary =20000 WHERE ID=100; UPDATE TableName SET Column1=Value1, Column1=Value1, …, ColumnN=ValueN [WHERE];
  • 32. Oracle Database, SQL32 DQL/DRL Data Query Language (DQL) or Data Retrieval Language (DRL) is the most concentrated focus of SQL for modern relational database users  SELECT The SQL SELECT statement is used to fetch the data from a database table which returns this data in the form of a result table. These result tables are called result-sets. The basic syntax of the SELECT statement is as follows − SELECT ID, Name,Salary From Customers; SELECT column1, column2, columnN FROM table_name;
  • 33. Oracle Database, SQL33 DCL It allow you to control access to data within the database. DCL commands are normally used to create objects related to user access and also control the distribution of privileges among users.  GRANT  REVOKE
  • 34. Oracle Database, SQL34 GRANT Use the GRANT statement to give privileges to a specific user or role, or to all users, to perform actions on database objects. You can also use the GRANT statement to grant a role to a user, to PUBLIC, or to another role. The following types of privileges can be granted:  Delete data from a specific table.  Insert data into a specific table.  Update data in a table or in a subset of columns in a table.  Select data from a table, view, or a subset of columns in a table.  Create a trigger on a table.  Run a specified function or procedure. The syntax that you use for the GRANT statement depends on whether you are granting privileges to a schema object or granting a role
  • 35. Oracle Database, SQL35 GRANT Privilege is the permission name, which is granted to the user. It may be SELECT, INSERT, UPDATE, DELETE, EXECUTE, ALL and many others, on a database object. Privileges are of two types System privilege – Schema level privilege which is granted by DBA to the users is known as System privilege. They include privilege to issue commands like CREATE (cluster, database link, directory, job, procedure, role, synonym, table, trigger, tablespace, types, view, database), ALTER, DROP, DEBUG, FLASHBACK, LOCK, CONNECT, RESOURCE etc. Please note that these privileges are not limited to an object access, but applicable at User level. Object privilege – Object level privilege can be granted from object owning user (Grantor) to other user (GRANTEE). Grantor permits access on a specific object and grantee enjoys the access privilege only on the database object concerned. It may be DELETE, SELECT, INSERT, UPDATE, EXECUTE, INDEX, READ, WRITE, ALTER (table, sequence).
  • 36. Oracle Database, SQL36 GRANT ADMIN option allows the Grantee to grant a System privilege to other user. Only DBA or user with GRANT ANY PRIVILEGE system privilege can grant a system privilege to other users. Users which possess a system privilege with ADMIN option can pass only that system privilege. GRANT option allows the Grantor (owner) to grant an Object privilege on an object to other user. To grant an object privilege, grantor must satisfy any of the below criteria: 1. He must own the object 2. He must have access on object with GRANT OPTION from the owner of the object 3. He must have GRANT ANY OBJECT PRIVILEGE system privilege and an object privilege on the object
  • 37. Oracle Database, SQL37 GRANT Syntax for objects GRANT [privilege] ON [object] TO {user |PUBLIC |role} [WITH ADMIN | GRANT OPTION]; GRANT SELECT ON T1 TO U2; GRANT CREATE INDEX TO U1 WITH ADMIN OPTION; Syntax for roles GRANT roleName [ {, roleName }* ] TO grantees
  • 38. Oracle Database, SQL38 REVOKE REVOKE command is used to revoke an existing privilege from a user. It can revoke a system privilege, object privilege or a role from a user. Only DBA or a user with ADMIN OPTION can revoke system privilege. REVOKE [privilege] ON [object] FROM {USER |PUBLIC | ROLE} REVOKE SELECT ON T1 FROM U1;
  • 39. Oracle Database, SQL39 DAL Data administration commands allow the user to perform audits and perform analyses on operations within the database. They can also be used to help analyze system performance. START AUDIT STOP AUDIT
  • 40. Oracle Database, SQL40 TCL It allow the user to manage database transactions. COMMIT Saves database transactions ROLLBACK Undoes database transactions SAVEPOINT Creates points within groups of transactions in which to ROLLBACK SET TRANSACTION Places a name on a transaction SET TRANSACTION READ ONLY NAME 'T1';
  • 41. Oracle Database, SQL41 Constraints Constraints are the rules enforced on the data columns of a table. These are used to limit the type of data that can go into a table. This ensures the accuracy and reliability of the data in the database. Constraints can be divided into following two types: • Column level constraints : limits only column data • Table level constraints : limits whole table data 1. NOT NULL 2. UNIQUE 3. PRIMARY KEY 4. FOREIGN KEY 5. CHECK 6. DEFAULT
  • 42. Oracle Database, SQL42 NOT NULL REVOKE command is used to revoke an existing privilege from a user. It can revoke a system privilege, object privilege or a role from a user. Only DBA or a user with ADMIN OPTION can revoke system privilege. REVOKE [privilege] ON [object] FROM {USER |PUBLIC | ROLE} REVOKE SELECT ON T1 FROM U1;
  • 43. Oracle Database, SQL43 NOT NULL constraint restricts a column from having a NULL value. Once NOT NULL constraint is applied to a column, you cannot pass a null value to that column. It enforces a column to contain a proper value. One important point to note about NOT NULL constraint is that it cannot be defined at table level.
  • 44. CONTACTS 44 Gurpreet Singh Senior Software Engineer CUG. 2142 M. +91-9803723925 Gurpreet.singh2@soprasteria.com Oracle Database, SQL