SlideShare a Scribd company logo
express course
S Q L
Course Content
321
5 64
7 8 9
Introduction to SQL
Basic concepts of 
databases.
Relational database 
objects.
Data types.
Queries
What is SQL?
What is DML?
The basic DML query 
is SELECT, INSERT, 
UPDATE, DELETE.
The basics of DDL
What is DDL?
CREATE, ALTER, DROP.
The concepts of user 
restrictions, primary 
and foreign keys.
JOIN­s
Internal connections.
External connections.
Review of 
associations.
Nested queries
Nested queries.
Linked nested 
queries.
Indexing
B­trees.
Consideration of all 
kinds of indices.
Stored procedures
Views.
Conditional 
constructions, loops, 
processing of error 
messages.
Stored procedures.
Functions.
Transactions. Triggers
Transactions.
Mechanisms of rollback 
of transactions.
Triggers.
Aggregating functions
Group by
Having by
Introduction to SQL
Basic concepts of databases
Database (DB)
Database management system (DBMS)
Entity
Entity key
Transaction
1
Introduction to SQL
Relational database objects
Cluster
Catalog
Scheme
Table and view
Columns and 
strings
1
Introduction to SQL
Relational database objects
Schema
Table
View
User
Synonym
Sequence
Index
Tablespace
Cluster
Partition
Function
Command
Trigger
Package
Snapshop
Database Link
Role
1
Introduction to SQL
Data types
 Numeric:     Date and time:      String:      Binary:      Other:
BIT
TINYINT
SMALLINT
INT
BIGINT
DECIMAL
NUMERIC
MONEY
FLOAT
REAL
DATE
TIME
DATETIME
CHAR
VARCHAR
NCHAR
NVARCHAR
TEXT
NTEXT
BINARY
VARBINARY 
UNIQUEIDENTIFIER
TIMESTAMP
CURSOR
SQL_VARIANT
XML
TABLE
GEOGRAPHY
GEOMETRY
link
1
Queries
What is SQL?
S     Structured
Q     Query
L     Language
2
Queries
What is DML?
D     Data
M     Manipulation
L     Language
2
Queries
The basic DML query is SELECT, INSERT, UPDATE, DELETE
SELECT [DISTINCT] column_list or *
FROM source
WHERE filter
ORDER BY expression_expression
2
Queries
The basic DML query is SELECT, INSERT, UPDATE, DELETE
SELECT *
FROM credit
2
Queries
The basic DML query is SELECT, INSERT, UPDATE, DELETE
SELECT *
FROM credit
SELECT Client_id, product_ref,current_payment
FROM dbo.credit
WHERE current_payment > 50
2
Queries
The basic DML query is SELECT, INSERT, UPDATE, DELETE
SELECT *
FROM credit
SELECT Client_id, product_ref,current_payment
FROM dbo.credit
WHERE current_payment > 50
SELECT 704*27.5, CURRENT_DATE, sin(1)
2
Queries
The basic DML query is SELECT, INSERT, UPDATE, DELETE
DISTINCT
SELECT client_id,product_code,product_ref
FROM credit
2
Queries
The basic DML query is SELECT, INSERT, UPDATE, DELETE
DISTINCT
SELECT client_id,product_code,product_ref
FROM credit
SELECT DISTINCT client_id
FROM credit
2
Queries
The basic DML query is SELECT, INSERT, UPDATE, DELETE
DISTINCT
SELECT client_id,product_code,product_ref
FROM credit
SELECT DISTINCT client_id
FROM credit
2
Queries
The basic DML query is SELECT, INSERT, UPDATE, DELETE
insert into <table name> ([<column name>, ... ]) values (<value>,...)
insert into credit(product_ref,current_payment) values('ABCDE@123456', 50.43);
2
Queries
The basic DML query is SELECT, INSERT, UPDATE, DELETE
insert into <table name> ([<column name>, ... ]) values (<value>,...)
insert into credit(product_ref,current_payment) values('ABCDE@123456', 50.43);
insert into <table name>([column name]) select <column list>... from <table name>
insert into credit(product_ref,current_payment)
select product_ref,current_payment
from clients
where current_payment >= 10
and current_payment < 5
2
Queries
The basic DML query is SELECT, INSERT, UPDATE, DELETE
UPDATE <table_name>
SET <column> = <value>
FROM <source_table>
Table _name
Column
Value
Source_table
2
Queries
The basic DML query is SELECT, INSERT, UPDATE, DELETE
DELETE FROM <table_name>
WHERE <condition>;
link
2
The basics of DDL
What is DDL?
D    Data 
D    Definition 
L    Language
3
The basics of DDL
CREATE, ALTER, DROP.
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
.....
columnN datatype,
PRIMARY KEY( one or more
columns )
);
CREATE TABLE credit
(
currency_rate numeric(5,2) NOT NULL DEFAULT(1.0),
current_payment numeric(10,2) NOT NULL,
days_past_due integer NOT NULL,
debt numeric(10,2) NOT NULL,
client_id integer NOT NULL,
product_ref character(19) NOT NULL,
product_pan character(25),
CONSTRAINT credit_pkey PRIMARY KEY (client_id, product_ref)
)
3
The basics of DDL
CREATE, ALTER, DROP.
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
.....
columnN datatype,
PRIMARY KEY( one or more
columns )
);
CREATE TABLE credit
(
currency_rate numeric(5,2) NOT NULL DEFAULT(1.0),
current_payment numeric(10,2) NOT NULL,
days_past_due integer NOT NULL,
debt numeric(10,2) NOT NULL,
client_id integer NOT NULL,
product_ref character(19) NOT NULL,
product_pan character(25),
CONSTRAINT credit_pkey PRIMARY KEY (client_id, product_ref)
)
CREATE TABLE new_table_name AS
SELECT column1, column2,...
FROM existing_table_name
WHERE ....;
CREATE TABLE copy_credit AS
SELECT client_id, product_ref
FROM credit
WHERE current_payment =100
CREATE TABLE new_table_name AS
SELECT column1, column2,...
FROM existing_table_name
WHERE ....;
3
The basics of DDL
CREATE, ALTER, DROP.
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
.....
columnN datatype,
PRIMARY KEY( one or more
columns )
);
CREATE TABLE credit
(
currency_rate numeric(5,2) NOT NULL DEFAULT(1.0),
current_payment numeric(10,2) NOT NULL,
days_past_due integer NOT NULL,
debt numeric(10,2) NOT NULL,
client_id integer NOT NULL,
product_ref character(19) NOT NULL,
product_pan character(25),
CONSTRAINT credit_pkey PRIMARY KEY (client_id, product_ref)
)
CREATE TABLE new_table_name AS
SELECT column1, column2,...
FROM existing_table_name
WHERE ....;
CREATE TABLE copy_credit AS
SELECT client_id, product_ref
FROM credit
WHERE current_payment =100
CREATE TABLE new_table_name AS
SELECT column1, column2,...
FROM existing_table_name
WHERE ....;
SELECT column1, column2,…
INTO new_table_name
FROM existing_table_name
WHERE ....;
SELECT client_id, product_ref
INTO new_table_name
FROM credit
WHERE current_payment=100;
3
The basics of DDL
CREATE, ALTER, DROP.
ALTER TABLE table_name
ADD column_name datatype;
ALTER TABLE table_name
DROP COLUMN column_name;
ALTER TABLE table_name
ALTER COLUMN column_name datatype;
3
The basics of DDL
The concepts of user restrictions, primary and foreign keys.
Primary key
Only one
16 columns maximun
Default NOT NULL
Default clustered
3
The basics of DDL
The concepts of user restrictions primary and foreign keys.
Dbo.credit
Dbo.dic_productPrimary key and UNIQUE.
Same database.
Can "live" in one table.
Same datatypes
Without temporary tables
Varchar(max)
3
COUNT specifies the number of rows or field values that are selected by query and are 
not NULL values;
 
SUM calculates the sum of all selected values of this field;
AVG calculates the average value for all selected values of this field;
МАХ calculates the largest of all selected values of this field;
MIN calculates the smallest of all selected values of this field.
Aggregating functions
Aggregating functions
The GROUP BY statement is often used with aggregate functions (COUNT, 
MAX, MIN, SUM, AVG) to group the result­set by one or more columns.
SELECT column_name(s)
FROM table_name
WHERE condition
GROUP BY column_name(s)
ORDER BY column_name(s);
select ClientId,count(distinct RefContract),avg(lim)
from RM.tCards
where lim>1000
group by ClientID
Aggregating functions
The GROUP BY statement is often used with aggregate functions (COUNT, 
MAX, MIN, SUM, AVG) to group the result­set by one or more columns.
SELECT column_name(s)
FROM table_name
WHERE condition
GROUP BY column_name(s)
ORDER BY column_name(s);
select ClientId,count(distinct RefContract),avg(lim)
from RM.tCards
where lim>1000
group by ClientID
SELECT column_name(s)
FROM table_name
WHERE condition
GROUP BY column_name(s)
HAVING BY condition
ORDER BY column_name(s);
Aggregating functions
Abs()
Current_date + interval '12 day'
Cast()
Case()
Date()
Isnull()
Trim()
Substring()
Replace()
JOIN­S
SELECT *
FROM Table_1              as t1
(LEFT|RIGHT) JOIN Table_2 as t2
ON {predicate}
WHERE {condition}
JOIN­S
SELECT *
FROM Table_1              as t1
(LEFT|RIGHT) JOIN Table_2 as t2
ON {predicate}
WHERE {condition}
JOIN­S
JOIN­S
https://www.pgadmin.org/
https://www.pgadmin.org/

More Related Content

Similar to SQL express course for begginers (20)

PPTX
Getting Started with SQL Language.pptx
Cecilia Brusatori
 
PPT
Revision sql te it new syllabus
saurabhshertukde
 
PDF
Rdbms day3
Nitesh Singh
 
PPT
Introduction to sql
VARSHAKUMARI49
 
PPTX
SQL-Demystified-A-Beginners-Guide-to-Database-Mastery.pptx
bhavaniteacher99
 
PPT
SA Chapter 10
Nuth Otanasap
 
PPTX
Sql
Rahul Singh
 
PDF
Sql
YUCHENG HU
 
PPTX
SQL - Structured query language introduction
Smriti Jain
 
PPTX
Chapter 2: Ms SQL Server
Ngeam Soly
 
PPTX
Session 8 connect your universal application with database .. builders & deve...
Moatasim Magdy
 
PPTX
Bank mangement system
FaisalGhffar
 
PPTX
Session 6#
Mohamed Samir
 
DOCX
How to design a database that include planning
Kamal Golan
 
PPTX
DBMS: Week 05 - Introduction to SQL Query
RashidFaridChishti
 
PPTX
Introduction to SQL Antipatterns
Krishnakumar S
 
PPT
Les09 (using ddl statements to create and manage tables)
Achmad Solichin
 
PPTX
Quick Revision on DATA BASE MANAGEMENT SYSTEMS concepts.pptx
fouziasulthanak
 
PDF
Assignment#01
Sunita Milind Dol
 
Getting Started with SQL Language.pptx
Cecilia Brusatori
 
Revision sql te it new syllabus
saurabhshertukde
 
Rdbms day3
Nitesh Singh
 
Introduction to sql
VARSHAKUMARI49
 
SQL-Demystified-A-Beginners-Guide-to-Database-Mastery.pptx
bhavaniteacher99
 
SA Chapter 10
Nuth Otanasap
 
SQL - Structured query language introduction
Smriti Jain
 
Chapter 2: Ms SQL Server
Ngeam Soly
 
Session 8 connect your universal application with database .. builders & deve...
Moatasim Magdy
 
Bank mangement system
FaisalGhffar
 
Session 6#
Mohamed Samir
 
How to design a database that include planning
Kamal Golan
 
DBMS: Week 05 - Introduction to SQL Query
RashidFaridChishti
 
Introduction to SQL Antipatterns
Krishnakumar S
 
Les09 (using ddl statements to create and manage tables)
Achmad Solichin
 
Quick Revision on DATA BASE MANAGEMENT SYSTEMS concepts.pptx
fouziasulthanak
 
Assignment#01
Sunita Milind Dol
 

Recently uploaded (20)

PPTX
Future_of_AI_Presentation for everyone.pptx
boranamanju07
 
PDF
apidays Munich 2025 - Making Sense of AI-Ready APIs in a Buzzword World, Andr...
apidays
 
PPTX
short term internship project on Data visualization
JMJCollegeComputerde
 
PPTX
UVA-Ortho-PPT-Final-1.pptx Data analytics relevant to the top
chinnusindhu1
 
PDF
Blitz Campinas - Dia 24 de maio - Piettro.pdf
fabigreek
 
PPTX
HSE WEEKLY REPORT for dummies and lazzzzy.pptx
ahmedibrahim691723
 
PPTX
MR and reffffffvvvvvvvfversal_083605.pptx
manjeshjain
 
PDF
202501214233242351219 QASS Session 2.pdf
lauramejiamillan
 
PPTX
7 Easy Ways to Improve Clarity in Your BI Reports
sophiegracewriter
 
PPT
introdution to python with a very little difficulty
HUZAIFABINABDULLAH
 
PPTX
Data-Driven Machine Learning for Rail Infrastructure Health Monitoring
Sione Palu
 
PPTX
Customer Segmentation: Seeing the Trees and the Forest Simultaneously
Sione Palu
 
PPTX
Solution+Architecture+Review+-+Sample.pptx
manuvratsingh1
 
PPTX
Presentation (1) (1).pptx k8hhfftuiiigff
karthikjagath2005
 
PPTX
Probability systematic sampling methods.pptx
PrakashRajput19
 
PPTX
Introduction to computer chapter one 2017.pptx
mensunmarley
 
PDF
WISE main accomplishments for ISQOLS award July 2025.pdf
StatsCommunications
 
PPT
Real Life Application of Set theory, Relations and Functions
manavparmar205
 
PDF
apidays Munich 2025 - Developer Portals, API Catalogs, and Marketplaces, Miri...
apidays
 
PPTX
M1-T1.pptxM1-T1.pptxM1-T1.pptxM1-T1.pptx
teodoroferiarevanojr
 
Future_of_AI_Presentation for everyone.pptx
boranamanju07
 
apidays Munich 2025 - Making Sense of AI-Ready APIs in a Buzzword World, Andr...
apidays
 
short term internship project on Data visualization
JMJCollegeComputerde
 
UVA-Ortho-PPT-Final-1.pptx Data analytics relevant to the top
chinnusindhu1
 
Blitz Campinas - Dia 24 de maio - Piettro.pdf
fabigreek
 
HSE WEEKLY REPORT for dummies and lazzzzy.pptx
ahmedibrahim691723
 
MR and reffffffvvvvvvvfversal_083605.pptx
manjeshjain
 
202501214233242351219 QASS Session 2.pdf
lauramejiamillan
 
7 Easy Ways to Improve Clarity in Your BI Reports
sophiegracewriter
 
introdution to python with a very little difficulty
HUZAIFABINABDULLAH
 
Data-Driven Machine Learning for Rail Infrastructure Health Monitoring
Sione Palu
 
Customer Segmentation: Seeing the Trees and the Forest Simultaneously
Sione Palu
 
Solution+Architecture+Review+-+Sample.pptx
manuvratsingh1
 
Presentation (1) (1).pptx k8hhfftuiiigff
karthikjagath2005
 
Probability systematic sampling methods.pptx
PrakashRajput19
 
Introduction to computer chapter one 2017.pptx
mensunmarley
 
WISE main accomplishments for ISQOLS award July 2025.pdf
StatsCommunications
 
Real Life Application of Set theory, Relations and Functions
manavparmar205
 
apidays Munich 2025 - Developer Portals, API Catalogs, and Marketplaces, Miri...
apidays
 
M1-T1.pptxM1-T1.pptxM1-T1.pptxM1-T1.pptx
teodoroferiarevanojr
 
Ad

SQL express course for begginers