SQL Functions SELECT, COUNT, DISTINCT, WHERE, LIKE, AGGREGATE, SUM (sum of a column values), MIN (minimum), MAX (maximum).

SQL for BEGINNERS
and DUMMIES

What is SQL, Table,
Database and RDBMS


What is Relational Database

PRIMARY KEY
FOREIGN KEY


Creating Tables and
Inserting Data

CREATE
ALTER
INSERT


Data Reading SQL
Funtions with Examples

SELECT
COUNT
DISTINCT
SUM | MIN | MAX
LIKE
WHERE

Sample Table Name: EMPTBL

EMPID NAME SALARY
1 ABC 10000
2 XYA 20000
3 PAR 30000
1 ABC 10000
2 XYA 20000

SELECT COUNT(*) FROM EMPTBL;

5

SELECT DISTINCT(NAME) FROM EMPTBL;

NAME
ABC
XYA
PAR


SELECT * FROM EMPTBL;

EMPID NAME SALARY
1 ABC 10000
2 XYA 20000
3 PAR 30000
1 ABC 10000
2 XYA 20000

SELECT SUM(SALARY) FROM EMPTBL;

90000

SELECT MIN(SALARY) FROM EMPTBL;

1000

SELECT MAX(SALARY) FROM EMPTBL;

3000

SELECT * FROM EMPTBL ORDER BY EMPID;

EMPID NAME SALARY
1 ABC 10000
1 ABC 10000
2 XYA 20000
2 XYA 20000
3 PAR 30000

SELECT * FROM EMPTBL WHERE SALARY > 10000;

EMPID NAME SALARY
2 XYA 20000
2 XYA 20000
3 PAR 30000

SELECT NAME FROM EMPTBL WHERE NAME LIKE 'A%';

NAME
ABC
ABC

SELECT NAME FROM EMPTBL WHERE NAME LIKE '%A';

NAME
XYA
XYA