You are on page 1of 26

THE DATA DIALOGUE

COMPLETE
SQL
Guide
Topic Wise Functions
1: THE DATA DIALOGUE

Basic SQL Syntax

▪ SQL keywords
▪ Data types
▪ Operators
▪ SQL statements
▪ SELECT
▪ INSERT
▪ UPDATE
▪ DELETE

@talhakhan 2
2: THE DATA DIALOGUE

Data Definition
Language (DDL)

▪ CREATE TABLE
▪ ALTER TABLE
▪ DROP TABLE
▪ TRUNCATE TABLE

@talhakhan 3
3: THE DATA DIALOGUE

Data Manipulation
Language (DML)

▪ SELECT statement (SELECT,


FROM, WHERE, ORDER BY,
GROUP BY, HAVING, JOINs)
▪ INSERT statement
▪ UPDATE statement
▪ DELETE statement

@talhakhan 4
4: THE DATA DIALOGUE

Aggregate Functions

▪ SUM, AVG, COUNT, MIN, MAX


▪ GROUP BY clause
▪ HAVING clause

@talhakhan 5
5: THE DATA DIALOGUE

Data Constraints

▪ Primary Key
▪ Foreign Key
▪ Unique
▪ NOT NULL
▪ CHECK

@talhakhan 6
6: THE DATA DIALOGUE

Joins

▪ INNER JOIN
▪ LEFT JOIN
▪ RIGHT JOIN
▪ FULL OUTER JOIN
▪ SELF JOIN
▪ CROSS JOIN

@talhakhan 7
7: THE DATA DIALOGUE

Subqueries

▪ Types of subqueries (scalar,


column, row, table)
▪ Nested subqueries
▪ Correlated subqueries

@talhakhan 8
8: THE DATA DIALOGUE

Advanced SQL
Functions

▪ String functions
▪ CONCAT, LENGTH, SUBSTRING,
REPLACE, UPPER, LOWER
▪ Date and time functions
▪ DATE, TIME, TIMESTAMP, DATEPART,
DATEADD
▪ Numeric functions:
▪ ROUND, CEILING, FLOOR, ABS, MOD
▪ Conditional functions:
▪ CASE, COALESCE, NULLIF

@talhakhan 9
9: THE DATA DIALOGUE

Views

▪ Creating views
▪ Modifying views
▪ Dropping views

@talhakhan 10
10: THE DATA DIALOGUE

Indexes

▪ Creating indexes
▪ CREATE INDEX
▪ Using indexes for query
optimization

@talhakhan 11
11: THE DATA DIALOGUE

Transactions

▪ ACID properties
▪ Transaction management:
▪ BEGIN, COMMIT, ROLLBACK,
SAVEPOINT
▪ Transaction isolation levels

@talhakhan 12
12: THE DATA DIALOGUE

Data Integrity and


Security

▪ Data integrity constraint


▪ Referential integrity, entity integrity
▪ GRANT and REVOKE
statements (granting and
revoking permissions)
▪ Database security best
practices

@talhakhan 13
13: THE DATA DIALOGUE

Stored Procedures and


Functions

▪ Creating stored procedures


▪ CREATE PROCEDURE
▪ Executing stored procedures
▪ EXEC
▪ Creating functions
▪ Using functions in queries

@talhakhan 14
14: THE DATA DIALOGUE

Performance
Optimization

▪ Query optimization
techniques
▪ Using indexes, optimizing joins,
reducing subqueries
▪ Performance tuning best
practices

@talhakhan 15
15: THE DATA DIALOGUE

Advanced SQL
Concepts
▪ Recursive queries
▪ Pivot and unpivot operations
▪ Window functions:
▪ Row_number, rank, dense_rank, lead
& lag
▪ CTEs (Common Table
Expressions)
▪ Dynamic SQL

@talhakhan 16
16: THE DATA DIALOGUE

Schema Management

▪ Creating schemas
▪ CREATE SCHEMA
▪ Altering schemas
▪ ALTER SCHEMA
▪ Dropping schemas
▪ DROP SCHEMA

@talhakhan 17
17: THE DATA DIALOGUE

Sequences and
Identity Columns

▪ Creating sequences/identity
columns
▪ Using sequences/identity
columns

@talhakhan 18
18: THE DATA DIALOGUE

Triggers

▪ Creating triggers
▪ CREATE TRIGGER
▪ Using triggers

@talhakhan 19
19: THE DATA DIALOGUE

Error Handling

▪ TRY-CATCH blocks
▪ Raising custom exceptions

@talhakhan 20
20: THE DATA DIALOGUE

Advanced SQL Data


Types

▪ BLOB
▪ CLOB
▪ ENUM
▪ SET, etc.

@talhakhan 21
21: THE DATA DIALOGUE

Partitioning

▪ Creating partitions
▪ PARTITION
▪ Using partitions

@talhakhan 22
22: THE DATA DIALOGUE

Regular Expressions

▪ Using REGEXP for pattern matching


in queries
▪ . (Dot): Matches any single character, except
newline characters
▪ * (Asterisk): Matches zero or more of the
preceding character or group
▪ + (Plus): Matches one or more of the
preceding character or group
▪ ? (Question mark): Matches zero or one of
the preceding character or group
▪ ^ (Caret): Matches the start of a string
without consuming any characters
▪ $ (Dollar): Matches the end of a string
without consuming any characters

@talhakhan 23
23: THE DATA DIALOGUE

Temporal Tables

▪ Creating temporal tables


▪ E.g. GENERATED ALWAYS
▪ Using temporal tables

@talhakhan 24
24: THE DATA DIALOGUE

Cursors

▪ Understanding and using


cursors
▪ DECLARE
▪ OPEN
▪ CLOSE
▪ DEALLOCATE

@talhakhan 25
THE DATA DIALOGUE
THANK YOU

If this helps, click on the


icon on my profile to
receive updates on similar
posts

@talhakhan

You might also like