Sap HCM Sap Successfactors Sap FSCM Sap Ariba Network Sap Fi Sap Concur Sap CRM Sap Hybris Cloud
Sap HCM Sap Successfactors Sap FSCM Sap Ariba Network Sap Fi Sap Concur Sap CRM Sap Hybris Cloud
Sap HCM Sap Successfactors Sap FSCM Sap Ariba Network Sap Fi Sap Concur Sap CRM Sap Hybris Cloud
SQL stands for Structured Query Language. SQL commands are the instructions used to
communicate with a database to perform tasks, functions, and queries with data. SQL
commands can be used to search the database and to do other functions like creating
tables, adding data to tables, modifying data, and dropping tables.
Open SQL is a set of ABAP statements that performs operations like reads, modifies or
deletes data in the SAP database. Open SQL is independent of the database system, so the
syntax of the open SQL is uniform for all the databases supported by SAP.
All open SQL statements are passed to the database interface. The DB interface converts the
open SQL to native SQL and passes it on to the database.
SQL can perform various tasks like create a table, add data to tables, drop the table,
modify the table, set permission for users.
SQL Commands
o SQL commands are instructions. It is used to communicate with the database. It is
also used to perform specific tasks, functions, and queries of data.
o SQL can perform various tasks like create a table, add data to tables, drop the table,
modify the table, set permission for users.
o CREATE
o ALTER
o DROP
o TRUNCATE
Syntax:
Play Video
Example:
b. DROP: It is used to delete both the structure and record stored in the table.
Syntax
Example
c. ALTER: It is used to alter the structure of the database. This change could be either
to modify the characteristics of an existing attribute or probably to add a new
attribute.
Syntax:
To add a new column in the table
EXAMPLE
d. TRUNCATE: It is used to delete all the rows from the table and free the space
containing the table.
Syntax:
Example:
o INSERT
o UPDATE
o DELETE
a. INSERT: The INSERT statement is a SQL query. It is used to insert data into the row
of a table.
Syntax:
For example:
b. UPDATE: This command is used to update or modify the value of a column in the
table.
Syntax:
For example:
1. UPDATE students
2. SET User_Name = 'Sonoo'
3. WHERE Student_Id = '3'
Syntax:
For example:
o Grant
o Revoke
a. Grant: It is used to give user access privileges to a database.
Example
Example
These operations are automatically committed in the database that's why they
cannot be used while creating tables or dropping them.
o COMMIT
o ROLLBACK
o SAVEPOINT
a. Commit: Commit command is used to save all the transactions to the database.
Syntax:
1. COMMIT;
Example:
b. Rollback: Rollback command is used to undo transactions that have not already
been saved to the database.
Syntax:
1. ROLLBACK;
Example:
Syntax:
1. SAVEPOINT SAVEPOINT_NAME;
5. Data Query Language
DQL is used to fetch the data from the database.
o SELECT
Syntax:
1. SELECT expressions
2. FROM TABLES
3. WHERE conditions;
For example:
1. SELECT emp_name
2. FROM employee
3. WHERE age > 20;
Open SQL is used to access database table defined in ABAP dictionary irrespective of the database
platform the R/3 system is based. In contrast, native SQL statements are used to access database tables not
defined in ABAP dictionary and hence allow us to integrate data not part of R/3 system.