01 SQL Introduction
01 SQL Introduction
• SQL is mainly for the users who perform ad-hoc queries and generate
reports.
• An SQL statement begins with a verb that describes the action, for
example, SELECT, INSERT, UPDATE or DELETE.
1
Introduction to SQL
(SQL - Structured Query Language)
2
Introduction to SQL
SQL consists of
• Data Definition Language (DDL)
3
DDL (Data Definition Language)
The data definition language deals with the schema creation and
modification.
e.g., CREATE TABLE statement allows you to create a new table in the
database
4
DML (Data Manipulation Language)
such as the SELECT statement and to update the data such as INSERT,
UPDATE, and DELETE statements.
5
DCL (Data Control Language)
The data control language consists of statements that deal with user
authorization and security ;
• Literals are explicit values which are also known as constants. SQL
provides three kinds of literals: string, numeric, and binary.
• SQL has many keywords that have special meanings such as SELECT,
INSERT, UPDATE, DELETE, and DROP.
7
SQL Terminologies
• These keywords are the reserved words; therefore, you cannot use
them as the name of tables, columns, indexes, views, stored
procedures, triggers, or other database objects.
8
Sample HR Database
9
Sample HR Database
• The HR sample database has seven tables:
• The jobs table stores the job data including job title and salary range.
• The locations table stores the location of the departments of the company.
• The countries table stores the data of countries where the company is
doing business.
• The regions table stores the data of regions such as Asia, Europe, America,
and the Middle East and Africa. The countries are grouped into regions.
10