DBMS SQL
Lesson 03: Basics of
SQL
Lesson Objectives
➢To understand the following topics:
• Interacting SQL using SQL *Plus
• Using SQL *Plus
• What is SQL?
• Rules for SQL statements
• Standard SQL Statement Groups
3.1: SQL
What is SQL?
➢SQL:
• SQL stands for Structured Query Language.
• SQL is used to communicate with a database.
• Statements are used to perform tasks such as update data on a
database, or retrieve data from a database.
• Benefits of SQL are:
• It is a Non-Procedural Language.
• It is a language for all users.
• It is a unified language.
What can SQL do?
➢SQL
• allows you to access a database.
• can execute queries against a database.
• can retrieve data from a database.
• can insert new records into a database.
• can delete records from a database.
• can update records in a database.
3.2: SQL
Rules for SQL statements
➢Rules for SQL statements:
• SQL keywords are not case sensitive. However, normally all
commands (SELECT, UPDATE, etc) are upper-cased.
• “Variable” and “parameter” names are displayed as lower-case.
• New-line characters are ignored in SQL.
• Many DBMS systems terminate SQL statements with a semi-colon
character.
• “Character strings” and “date values” are enclosed in single
quotation marks while using them in WHERE clause or otherwise.
3.3: SQL
Standard SQL statement groups
Given below are the standard SQL statement groups:
Groups Statements Description
DQL SELECT DATA QUERY LANGUAGE – It is used to get data from
the database and impose ordering upon it.
DML DELETE DATA MANIPULATION LANGUAGE – It is used to change
INSERT database data.
UPDATE
MERGE
DDL DROP DATA DEFINITION LANGUAGE – It is used to manipulate
TRUNCATE database structures and definitions.
CREATE
ALTER
TCL COMMIT TCL statements are used to manage the transactions.
ROLLBACK
SAVEPOINT
DCL REVOKE They are used to remove and provide access rights to
(Rights) GRANT database objects.
SQL* Plus Tool
Logging to Oracle Server using iSQLPlus
➢To log into the iSQL*Plus environment:
• In the Windows browser, type the URL in the address field. The user
will be directed to iSQL*Plus environment screen.
Logging to Oracle Server using iSQLPlus
➢To connect to the Oracle server:
• Select Start, go to Programs, and select Oracle-OraHome8I.
• Go to Application Development, and select SQL Plus. You will get the
following logon screen:
Connect to SQL*Plus
Summary
➢In this lesson, you have learnt:
• What is SQL?
• Rules for SQL statements
• Standard SQL statement groups
• SQL*PLUS environment
Review Question
➢Question 1: SQL ___.
• Option 1: cannot execute queries against a database.
• Option 2: can manipulate data from a database.
• Option 3: cannot retrieve data from a database.
• Option 4: can insert new records in a database.
• Option 5: can delete records from a database.
Review Question
➢Question 2: SQL categories are ___.
• Option 1: DDL
• Option 2: DML
• Option 3: DSL
• Option 4: DQL
• Option 5: TCL
• Option 6: TDL