SlideShare a Scribd company logo
SQL – Pocket Guide
-By Santhosh Kumar
MySQL standards
•

•
•
•

MySQL is the most popular Open Source Relational SQL database management
system.
MySQL is one of the best RDBMS being used for developing web based software
applications.
MySQL database application should be installed on your web server. MySQL is very
popular so you will have no problem in finding a web host that offers MySQL.
Most web host also offer a (GUI) Graphical user interface application such as
PHPMyAdmin for working with MySQL databases.
Terminology
•
•
•
•
•
•
•
•
•
•

Database: A database is a collection of tables, with related data.
Table: A table is a matrix with data. A table in a database looks like a simple
spreadsheet.
Column: One column (data element) contains data of one and the same kind, for
example the column postcode.
Row: A row (= tuple, entry or record) is a group of related data, for example the
data of one subscription.
Redundancy: Storing data twice, redundantly to make the system faster.
Primary Key: A primary key is unique. A key value can not occur twice in one table.
With a key you can find at most one row.
Foreign Key: A foreign key is the linking pin between two tables.
Compound Key: A compound key (composite key) is a key that consists of multiple
columns, because one column is not sufficiently unique.
Index: An index in a database resembles an index at the back of a book.
Referential Integrity: Referential Integrity makes sure that a foreign key value
always points to an existing row.
What is – DML, DDL, DCL and TCL
•

DML

•

DML is abbreviation of Data Manipulation Language. It is used to retrieve,
store, modify, delete, insert and update data in database.
DDL
DDL is abbreviation of Data Definition Language. It is used to create and
modify the structure of database objects in database.

•

DCL
DCL is abbreviation of Data Control Language. It is used to create roles,
permissions, and referential integrity as well it is used to control access to database
by securing it.

•

TCL
TCL is abbreviation of Transactional Control Language. It is used to manage
different transactions occurring within a database.
Commands
•

DDL : CREATE, ALTER, DROP

•

DML : INSERT, UPDATE, DELETE

•

DCL : GRANT, REVOKE

•

TCL : COMMIT, SAVE POINT, ROLLBACK

•

DQL : SELECT
Basic SQl Commands
•
•
•
•
•
•
•
•
•
•
•

SELECT - extracts data from a database
UPDATE - updates data in a database
DELETE - deletes data from a database
INSERT INTO - inserts new data into a database
CREATE DATABASE - creates a new database
ALTER DATABASE - modifies a database
CREATE TABLE - creates a new table
ALTER TABLE - modifies a table
DROP TABLE - deletes a table
CREATE INDEX - creates an index (search key)
DROP INDEX - deletes an index
Basic SQL Functions
•

SQL Aggregate Functions
–

SQL aggregate functions return a single value, calculated from values in a column.

AVG() - Returns the average value
COUNT() - Returns the number of rows
FIRST() - Returns the first value
LAST() - Returns the last value
MAX() - Returns the largest value
MIN() - Returns the smallest value
SUM() - Returns the sum
Basic SQL Functions
•

SQL Scalar functions
–

SQL scalar functions return a single value, based on the input value.

UCASE() - Converts a field to upper case
LCASE() - Converts a field to lower case
MID() - Extract characters from a text field
LEN() - Returns the length of a text field
ROUND() - Rounds a numeric field to the number of decimals specified
NOW() - Returns the current system date and time
FORMAT() - Formats how a field is to be displayed
Joins
SQL joins are used to combine rows from two or more tables

•

INNER JOIN: Returns all rows when there is at least one match in BOTH tables

•

LEFT JOIN: Return all rows from the left table, and the matched rows from the
right table

•

RIGHT JOIN: Return all rows from the right table, and the matched rows from the
left table

•

FULL JOIN: Return all rows when there is a match in ONE of the tables
Many Thanks
For More : Find in Google 

Many Thanks
Santhosh Kumar

More Related Content

What's hot

Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
Md.Mojibul Hoque
 
Data concepts
Data conceptsData concepts
Data concepts
Sachidananda M H
 
What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?
CPD INDIA
 
Sql 2009
Sql 2009Sql 2009
Sql 2009
Cathie101
 
SQL: Structured Query Language
SQL: Structured Query LanguageSQL: Structured Query Language
SQL: Structured Query Language
Rohit Bisht
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
webhostingguy
 
MySQL and its basic commands
MySQL and its basic commandsMySQL and its basic commands
MySQL and its basic commands
Bwsrang Basumatary
 
Object relational database management system
Object relational database management systemObject relational database management system
Object relational database management system
Saibee Alam
 
Database Fundamental Concepts- Series 1 - Performance Analysis
Database Fundamental Concepts- Series 1 - Performance AnalysisDatabase Fundamental Concepts- Series 1 - Performance Analysis
Database Fundamental Concepts- Series 1 - Performance Analysis
DAGEOP LTD
 
Sql commands
Sql commandsSql commands
Sql commands
Prof. Dr. K. Adisesha
 
sql statements & joins
sql statements & joinssql statements & joins
sql statements & joins
Safva AP
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
Aditya Kumar Tripathy
 
SQL
SQLSQL
Software Database and Testing
Software Database and TestingSoftware Database and Testing
Software Database and Testing
QualityAssuranceGroup
 
Introduction to mysql part 1
Introduction to mysql part 1Introduction to mysql part 1
An intoduction to sql and its components
An intoduction to sql and its componentsAn intoduction to sql and its components
An intoduction to sql and its components
Monika Jain DAIMSR
 
SQL SERVER Training in Pune Slides
SQL SERVER Training in Pune SlidesSQL SERVER Training in Pune Slides
SQL SERVER Training in Pune Slides
enosislearningcom
 
Sql and Sql commands
Sql and Sql commandsSql and Sql commands
Sql and Sql commands
Knowledge Center Computer
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Database Architecture and Basic Concepts
Database Architecture and Basic ConceptsDatabase Architecture and Basic Concepts
Database Architecture and Basic Concepts
Tony Wong
 

What's hot (20)

Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
 
Data concepts
Data conceptsData concepts
Data concepts
 
What is SQL Server?
What is SQL Server?What is SQL Server?
What is SQL Server?
 
Sql 2009
Sql 2009Sql 2009
Sql 2009
 
SQL: Structured Query Language
SQL: Structured Query LanguageSQL: Structured Query Language
SQL: Structured Query Language
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
MySQL and its basic commands
MySQL and its basic commandsMySQL and its basic commands
MySQL and its basic commands
 
Object relational database management system
Object relational database management systemObject relational database management system
Object relational database management system
 
Database Fundamental Concepts- Series 1 - Performance Analysis
Database Fundamental Concepts- Series 1 - Performance AnalysisDatabase Fundamental Concepts- Series 1 - Performance Analysis
Database Fundamental Concepts- Series 1 - Performance Analysis
 
Sql commands
Sql commandsSql commands
Sql commands
 
sql statements & joins
sql statements & joinssql statements & joins
sql statements & joins
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
 
SQL
SQLSQL
SQL
 
Software Database and Testing
Software Database and TestingSoftware Database and Testing
Software Database and Testing
 
Introduction to mysql part 1
Introduction to mysql part 1Introduction to mysql part 1
Introduction to mysql part 1
 
An intoduction to sql and its components
An intoduction to sql and its componentsAn intoduction to sql and its components
An intoduction to sql and its components
 
SQL SERVER Training in Pune Slides
SQL SERVER Training in Pune SlidesSQL SERVER Training in Pune Slides
SQL SERVER Training in Pune Slides
 
Sql and Sql commands
Sql and Sql commandsSql and Sql commands
Sql and Sql commands
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Database Architecture and Basic Concepts
Database Architecture and Basic ConceptsDatabase Architecture and Basic Concepts
Database Architecture and Basic Concepts
 

Similar to Sql – pocket guide

xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
WrushabhShirsat3
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
NilamHonmane
 
SQL
SQLSQL
industrial training ppt for btech 3rd year student
industrial training ppt for btech 3rd year studentindustrial training ppt for btech 3rd year student
industrial training ppt for btech 3rd year student
aniketchaturvedi1727
 
Mysql-overview.pptx
Mysql-overview.pptxMysql-overview.pptx
Mysql-overview.pptx
TamilHunt
 
SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
AnshumanDwivedi14
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
Danish Mehraj
 
Module02
Module02Module02
Module02
Sridhar P
 
MySQL intro
MySQL introMySQL intro
MySQL intro
MySQL introMySQL intro
PT- Oracle session01
PT- Oracle session01 PT- Oracle session01
PT- Oracle session01
Karthik Venkatachalam
 
dbs class 7.ppt
dbs class 7.pptdbs class 7.ppt
dbs class 7.ppt
MARasheed3
 
Presentation1
Presentation1Presentation1
Presentation1
ahsan-1252
 
Getting Started with MySQL I
Getting Started with MySQL IGetting Started with MySQL I
Getting Started with MySQL I
Sankhya_Analytics
 
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
Amazon Web Services
 
Complete first chapter rdbm 17332
Complete first chapter rdbm 17332Complete first chapter rdbm 17332
Complete first chapter rdbm 17332
Tushar Wagh
 
PO WER - Piotr Mariat - Sql
PO WER - Piotr Mariat - SqlPO WER - Piotr Mariat - Sql
PO WER - Piotr Mariat - Sql
Zespół Szkół nr 26
 
Sql
SqlSql
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
PavithSingh
 
DataBase Management systems (IM).pptx
DataBase Management systems (IM).pptxDataBase Management systems (IM).pptx
DataBase Management systems (IM).pptx
GooglePay16
 

Similar to Sql – pocket guide (20)

xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
 
SQL
SQLSQL
SQL
 
industrial training ppt for btech 3rd year student
industrial training ppt for btech 3rd year studentindustrial training ppt for btech 3rd year student
industrial training ppt for btech 3rd year student
 
Mysql-overview.pptx
Mysql-overview.pptxMysql-overview.pptx
Mysql-overview.pptx
 
SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
 
Module02
Module02Module02
Module02
 
MySQL intro
MySQL introMySQL intro
MySQL intro
 
MySQL intro
MySQL introMySQL intro
MySQL intro
 
PT- Oracle session01
PT- Oracle session01 PT- Oracle session01
PT- Oracle session01
 
dbs class 7.ppt
dbs class 7.pptdbs class 7.ppt
dbs class 7.ppt
 
Presentation1
Presentation1Presentation1
Presentation1
 
Getting Started with MySQL I
Getting Started with MySQL IGetting Started with MySQL I
Getting Started with MySQL I
 
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
(BDT401) Amazon Redshift Deep Dive: Tuning and Best Practices
 
Complete first chapter rdbm 17332
Complete first chapter rdbm 17332Complete first chapter rdbm 17332
Complete first chapter rdbm 17332
 
PO WER - Piotr Mariat - Sql
PO WER - Piotr Mariat - SqlPO WER - Piotr Mariat - Sql
PO WER - Piotr Mariat - Sql
 
Sql
SqlSql
Sql
 
SQL.pptx for the begineers and good know
SQL.pptx for the begineers and good knowSQL.pptx for the begineers and good know
SQL.pptx for the begineers and good know
 
DataBase Management systems (IM).pptx
DataBase Management systems (IM).pptxDataBase Management systems (IM).pptx
DataBase Management systems (IM).pptx
 

Recently uploaded

Understanding of Self - Applied Social Psychology - Psychology SuperNotes
Understanding of Self - Applied Social Psychology - Psychology SuperNotesUnderstanding of Self - Applied Social Psychology - Psychology SuperNotes
Understanding of Self - Applied Social Psychology - Psychology SuperNotes
PsychoTech Services
 
Strategies to rekindle the fire inside you and stay motivated.pdf
Strategies to rekindle the fire inside you and stay motivated.pdfStrategies to rekindle the fire inside you and stay motivated.pdf
Strategies to rekindle the fire inside you and stay motivated.pdf
Million-$-Knowledge {Million Dollar Knowledge}
 
aula open english sobre Classic-motorcycles-2_1.pdf
aula open english sobre Classic-motorcycles-2_1.pdfaula open english sobre Classic-motorcycles-2_1.pdf
aula open english sobre Classic-motorcycles-2_1.pdf
PauloVictor90882
 
Inspire: Igniting the Spark of Human Potential
Inspire: Igniting the Spark of Human PotentialInspire: Igniting the Spark of Human Potential
Inspire: Igniting the Spark of Human Potential
gauravingole9
 
The Secret Warrior - Help Share a Parent or Loved Ones’ Cancer Diagnosis with...
The Secret Warrior - Help Share a Parent or Loved Ones’ Cancer Diagnosis with...The Secret Warrior - Help Share a Parent or Loved Ones’ Cancer Diagnosis with...
The Secret Warrior - Help Share a Parent or Loved Ones’ Cancer Diagnosis with...
CANSA The Cancer Association of South Africa
 
Best Way to Overcome Procrastination and Increase Productivity.pdf
Best Way to Overcome Procrastination and Increase Productivity.pdfBest Way to Overcome Procrastination and Increase Productivity.pdf
Best Way to Overcome Procrastination and Increase Productivity.pdf
Million-$-Knowledge {Million Dollar Knowledge}
 

Recently uploaded (6)

Understanding of Self - Applied Social Psychology - Psychology SuperNotes
Understanding of Self - Applied Social Psychology - Psychology SuperNotesUnderstanding of Self - Applied Social Psychology - Psychology SuperNotes
Understanding of Self - Applied Social Psychology - Psychology SuperNotes
 
Strategies to rekindle the fire inside you and stay motivated.pdf
Strategies to rekindle the fire inside you and stay motivated.pdfStrategies to rekindle the fire inside you and stay motivated.pdf
Strategies to rekindle the fire inside you and stay motivated.pdf
 
aula open english sobre Classic-motorcycles-2_1.pdf
aula open english sobre Classic-motorcycles-2_1.pdfaula open english sobre Classic-motorcycles-2_1.pdf
aula open english sobre Classic-motorcycles-2_1.pdf
 
Inspire: Igniting the Spark of Human Potential
Inspire: Igniting the Spark of Human PotentialInspire: Igniting the Spark of Human Potential
Inspire: Igniting the Spark of Human Potential
 
The Secret Warrior - Help Share a Parent or Loved Ones’ Cancer Diagnosis with...
The Secret Warrior - Help Share a Parent or Loved Ones’ Cancer Diagnosis with...The Secret Warrior - Help Share a Parent or Loved Ones’ Cancer Diagnosis with...
The Secret Warrior - Help Share a Parent or Loved Ones’ Cancer Diagnosis with...
 
Best Way to Overcome Procrastination and Increase Productivity.pdf
Best Way to Overcome Procrastination and Increase Productivity.pdfBest Way to Overcome Procrastination and Increase Productivity.pdf
Best Way to Overcome Procrastination and Increase Productivity.pdf
 

Sql – pocket guide

  • 1. SQL – Pocket Guide -By Santhosh Kumar
  • 2. MySQL standards • • • • MySQL is the most popular Open Source Relational SQL database management system. MySQL is one of the best RDBMS being used for developing web based software applications. MySQL database application should be installed on your web server. MySQL is very popular so you will have no problem in finding a web host that offers MySQL. Most web host also offer a (GUI) Graphical user interface application such as PHPMyAdmin for working with MySQL databases.
  • 3. Terminology • • • • • • • • • • Database: A database is a collection of tables, with related data. Table: A table is a matrix with data. A table in a database looks like a simple spreadsheet. Column: One column (data element) contains data of one and the same kind, for example the column postcode. Row: A row (= tuple, entry or record) is a group of related data, for example the data of one subscription. Redundancy: Storing data twice, redundantly to make the system faster. Primary Key: A primary key is unique. A key value can not occur twice in one table. With a key you can find at most one row. Foreign Key: A foreign key is the linking pin between two tables. Compound Key: A compound key (composite key) is a key that consists of multiple columns, because one column is not sufficiently unique. Index: An index in a database resembles an index at the back of a book. Referential Integrity: Referential Integrity makes sure that a foreign key value always points to an existing row.
  • 4. What is – DML, DDL, DCL and TCL • DML • DML is abbreviation of Data Manipulation Language. It is used to retrieve, store, modify, delete, insert and update data in database. DDL DDL is abbreviation of Data Definition Language. It is used to create and modify the structure of database objects in database. • DCL DCL is abbreviation of Data Control Language. It is used to create roles, permissions, and referential integrity as well it is used to control access to database by securing it. • TCL TCL is abbreviation of Transactional Control Language. It is used to manage different transactions occurring within a database.
  • 5. Commands • DDL : CREATE, ALTER, DROP • DML : INSERT, UPDATE, DELETE • DCL : GRANT, REVOKE • TCL : COMMIT, SAVE POINT, ROLLBACK • DQL : SELECT
  • 6. Basic SQl Commands • • • • • • • • • • • SELECT - extracts data from a database UPDATE - updates data in a database DELETE - deletes data from a database INSERT INTO - inserts new data into a database CREATE DATABASE - creates a new database ALTER DATABASE - modifies a database CREATE TABLE - creates a new table ALTER TABLE - modifies a table DROP TABLE - deletes a table CREATE INDEX - creates an index (search key) DROP INDEX - deletes an index
  • 7. Basic SQL Functions • SQL Aggregate Functions – SQL aggregate functions return a single value, calculated from values in a column. AVG() - Returns the average value COUNT() - Returns the number of rows FIRST() - Returns the first value LAST() - Returns the last value MAX() - Returns the largest value MIN() - Returns the smallest value SUM() - Returns the sum
  • 8. Basic SQL Functions • SQL Scalar functions – SQL scalar functions return a single value, based on the input value. UCASE() - Converts a field to upper case LCASE() - Converts a field to lower case MID() - Extract characters from a text field LEN() - Returns the length of a text field ROUND() - Rounds a numeric field to the number of decimals specified NOW() - Returns the current system date and time FORMAT() - Formats how a field is to be displayed
  • 9. Joins SQL joins are used to combine rows from two or more tables • INNER JOIN: Returns all rows when there is at least one match in BOTH tables • LEFT JOIN: Return all rows from the left table, and the matched rows from the right table • RIGHT JOIN: Return all rows from the right table, and the matched rows from the left table • FULL JOIN: Return all rows when there is a match in ONE of the tables
  • 10. Many Thanks For More : Find in Google  Many Thanks Santhosh Kumar