SlideShare a Scribd company logo
 ANY USEFUL INFORMATION IS A DATA
 IN SIMPLE WORDS DATA CAN BE FACTS RELATED TO ANY OBJECT IN CONSIDERATION
 FOR EXAMPLE YOUR NAME, AGE, HEIGHT, WEIGHT, ETC. ARE SOME DATA RELATED TO YOU.
A PICTURE , IMAGE , FILE , PDF ETC. CAN ALSO BE CONSIDERED DATA
What is Data?
What is Database?
 A database is a systematic collection of data.
Databases support storage and manipulation of data.
Databases make data management easy
 Ex: An online telephone directory
WHAT IS A DATABASE
MANAGEMENT SYSTEM (DBMS)?
• Database Management System (DBMS) is a collection of programs which
enables its users to access database, manipulate data, reporting /
representation of data . It also helps to control access to the database.
• Database Management Systems are not a new concept and as such had been
first implemented in 1960s. Charles Bachmen's Integrated Data Store(IDS) is
said to be the first DBMS in history
TYPES OF DBMS:
• Hierarchical - this type of DBMS employs the "parent-child"
relationship of storing data. The windows registry used in
Windows OS is an example of a hierarchical database.
• Network DBMS - this type of DBMS supports many-to many
relations. Ex: RDM Server
• Relational DBMS - this type of DBMS defines database
relationships in form of tables, also known as relations Ex:
MySQL, Oracle and Microsoft SQL Server
WHAT IS RELATIONAL
DATABASE?
It is the collection of relations or two dimensional tables
Dr E.F Codd proposed the relational model for database system in 1969
Relational Model Consists of following :
• Collections of Objects or Relations
• Set of Operators to act on the relations
• Data integrity for accuracy and consistency.
(Data integrity is the one which contains correct data in the database)
To Preserve data integrity we have two types:
1.DataType: Data Type is a type of data which you store in each column
2.Constraints
CONSTRAINTS:
A constraint is a condition which restricts the invalid data in the table.
A constraint can be provided for a column of a table.
Types of Constraints
1. NOT NULL
2. UNIQUE
3. Primary Key
4. Foreign Key
5. Check
NOT NULL -
• NULL is nothing, it is neither zero nor blank space. It will not occupy any space in the memory
• NOT NULL will ensure at least some value should be present in a column
UNIQUE -
• It will not allow any duplicates in a column
• UNIQUE column can take multiple NULL (s)
Primary Key
• It is the combination of NOT NULL and UNIQUE
• Only one PK is allowed in a table
• PK identifies a record uniquely in a table
Foreign Key
• FK creates relationship between any two tables
• FK is created on the child table
• FK can take both NULL and duplicate values
• We can have more than 1 FK in a given table
CHECK
• It is used to provide additional validations as per the customer requirements.
SQL:
• Developed by IBM SQL – Structured Query Language.
• SQL – it is a language to talk to the database / to access the database
• To work on SQL , a DB software (RDBMS) is required.
• SQL is not case sensitive
What is SQL?
Structured Query language (SQL) pronounced as "S-Q-L" or sometimes as
“See-Quel” is actually the standard language for dealing with Relational
Databases. SQL can be effectively used to insert, search, update, delete
database records.
SQL STATEMENTS:
SQL STATEMENTS:
SQL SELECT Statement
SELECT column1, column2....columnN FROM table_name;
SQL WHERE Clause
SELECT column1, column2....columnN FROM table_name WHERE
CONDITION;
SQL> SELECT ID, NAME, SALARY FROM CUSTOMERS;
SQL> SELECT ID, NAME, SALARY FROM CUSTOMERS WHERE SALARY > 2000;
SQL STATEMENTS:
SQL ORDER BY Clause
SELECT column1, column2....columnN FROM table_name WHERE
CONDITION ORDER BY column_name {ASC|DESC};
SQL GROUP BY Clause
SELECT SUM(column_name) FROM table_name WHERE CONDITION
GROUP BY column_name;
SQL> SELECT * FROM CUSTOMERS ORDER BY NAME, SALARY;
SQL> SELECT NAME, SUM(SALARY) FROM CUSTOMERS GROUP BY NAME;
SQL STATEMENTS:
SQL CREATE TABLE Statement
CREATE TABLE table_name( column1 datatype, column2
datatype, column3 datatype, ..... columnN datatype,
PRIMARY KEY( one or more columns ) );
SQL DROP TABLE Statement
DROP TABLE table_name;
SQL>
CREATE TABLE CUSTOMERS
(ID INT NOT NULL,
NAME VARCHAR (20) NOT NULL,
AGE INT NOT NULL,
ADDRESS CHAR (25),
SALARY DECIMAL (18, 2),
PRIMARY KEY (ID));
SQL> DROP TABLE CUSTOMERS;
SQL> DESC CUSTOMERS;
ERROR 1146 (42S02): Table 'TEST.CUSTOMERS' doesn't exist
SQL STATEMENTS:
SQL TRUNCATE TABLE Statement
TRUNCATE TABLE table_name;
SQL INSERT INTO Statement
INSERT INTO table_name( column1, column2....columnN)
VALUES ( value1, value2....valueN);
SQL > TRUNCATE TABLE CUSTOMERS;
SQL> SELECT * FROM CUSTOMERS;
Empty set (0.00 sec)
INSERT INTO CUSTOMERS VALUES (7, 'Muffy', 24, 'Indore', 10000.00 );
SQL STATEMENTS:
SQL UPDATE Statement
UPDATE table_name SET column1 = value1, column2 =
value2....columnN=valueN [ WHERE CONDITION ];
SQL DELETE Statement
DELETE FROM table_name WHERE {CONDITION};
SQL> UPDATE CUSTOMERS SET ADDRESS = 'Pune' WHERE ID = 6;
SQL> DELETE FROM CUSTOMERS WHERE ID = 6;
SQL JOINS
• The SQL Joins clause is used to combine records from two or more tables in a
database. A JOIN is a means for combining fields from two tables by using values
common to each.
There are different types of joins available in SQL −
•INNER JOIN − returns rows when there is a match in both
tables.
•LEFT JOIN − returns all rows from the left table, even if there are
no matches in the right table.
•RIGHT JOIN − returns all rows from the right table, even if there
are no matches in the left table.
•FULL JOIN − returns rows when there is a match in one of the
tables.
•SELF JOIN − is used to join a table to itself as if the table were
two tables, temporarily renaming at least one table in the SQL
statement.
INNER JOIN:
SELECT table1.column1, table2.column2... FROM table1
INNER JOIN table2 ON table1.common_field = table2.common_field;
SQL> SELECT ID, NAME, AMOUNT, DATE FROM CUSTOMERS
INNER JOIN ORDERS ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID;
LEFT JOIN:
SELECT table1.column1, table2.column2... FROM table1
LEFT JOIN table2 ON table1.common_field = table2.common_field;
SQL> SELECT ID, NAME, AMOUNT, DATE FROM CUSTOMERS
LEFT JOIN ORDERS ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID;
RIGHT JOIN:
SELECT table1.column1, table2.column2... FROM table1
RIGHT JOIN table2 ON table1.common_field = table2.common_field;
SQL> SELECT ID, NAME, AMOUNT, DATE FROM CUSTOMERS
RIGHT JOIN ORDERS ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID;
FULL JOIN:
SELECT table1.column1, table2.column2... FROM table1
FULL JOIN table2 ON table1.common_field = table2.common_field;
SQL> SELECT ID, NAME, AMOUNT, DATE FROM CUSTOMERS
FULL JOIN ORDERS ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID;

More Related Content

What's hot

DBMS-Quick Reference
DBMS-Quick ReferenceDBMS-Quick Reference
DBMS-Quick Reference
Shrija Madhu
 
Introduction to Database Concepts
Introduction to Database ConceptsIntroduction to Database Concepts
Introduction to Database Concepts
Rosalyn Lemieux
 
Relational Database Fundamentals
Relational Database FundamentalsRelational Database Fundamentals
Relational Database Fundamentals
KHALID C
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
Aditya Kumar Tripathy
 
RDBMS concepts
RDBMS conceptsRDBMS concepts
Relational data model
Relational data modelRelational data model
Relational data model
SURBHI SAROHA
 
Database Indexes
Database IndexesDatabase Indexes
Database Indexes
Sperasoft
 
Indexes
IndexesIndexes
An hour with Database and SQL
An hour with Database and SQLAn hour with Database and SQL
An hour with Database and SQL
Iraj Hedayati
 
Sql basics
Sql basicsSql basics
Sql basics
Raghu nath
 
Index in sql server
Index in sql serverIndex in sql server
Index in sql server
Durgaprasad Yadav
 
Mdst 3559-02-24-sql2
Mdst 3559-02-24-sql2Mdst 3559-02-24-sql2
Mdst 3559-02-24-sql2
Rafael Alvarado
 
demo2.ppt
demo2.pptdemo2.ppt
demo2.ppt
crazyvirtue
 
Database Languges
Database LangugesDatabase Languges
Database Languges
Ahmed Rodeni
 
Data Dictionary
Data DictionaryData Dictionary
Data Dictionary
Forrester High School
 
Introduction - Database (MS Access)
Introduction - Database (MS Access)Introduction - Database (MS Access)
Introduction - Database (MS Access)
Methnuwan Kariyawasam
 
SQL_Part1
SQL_Part1SQL_Part1
SQL_Part1
Rick Perry
 
Rdbms terminology
Rdbms terminologyRdbms terminology
Rdbms terminology
Harish Gyanani
 

What's hot (18)

DBMS-Quick Reference
DBMS-Quick ReferenceDBMS-Quick Reference
DBMS-Quick Reference
 
Introduction to Database Concepts
Introduction to Database ConceptsIntroduction to Database Concepts
Introduction to Database Concepts
 
Relational Database Fundamentals
Relational Database FundamentalsRelational Database Fundamentals
Relational Database Fundamentals
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
 
RDBMS concepts
RDBMS conceptsRDBMS concepts
RDBMS concepts
 
Relational data model
Relational data modelRelational data model
Relational data model
 
Database Indexes
Database IndexesDatabase Indexes
Database Indexes
 
Indexes
IndexesIndexes
Indexes
 
An hour with Database and SQL
An hour with Database and SQLAn hour with Database and SQL
An hour with Database and SQL
 
Sql basics
Sql basicsSql basics
Sql basics
 
Index in sql server
Index in sql serverIndex in sql server
Index in sql server
 
Mdst 3559-02-24-sql2
Mdst 3559-02-24-sql2Mdst 3559-02-24-sql2
Mdst 3559-02-24-sql2
 
demo2.ppt
demo2.pptdemo2.ppt
demo2.ppt
 
Database Languges
Database LangugesDatabase Languges
Database Languges
 
Data Dictionary
Data DictionaryData Dictionary
Data Dictionary
 
Introduction - Database (MS Access)
Introduction - Database (MS Access)Introduction - Database (MS Access)
Introduction - Database (MS Access)
 
SQL_Part1
SQL_Part1SQL_Part1
SQL_Part1
 
Rdbms terminology
Rdbms terminologyRdbms terminology
Rdbms terminology
 

Similar to Sql introduction

Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
Mian Abdul Raheem
 
SQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfSQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdf
DraguClaudiu
 
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
 
SQL
SQLSQL
SQL | DML
SQL | DMLSQL | DML
SQL | DML
To Sum It Up
 
DATABASE-1.pptx
DATABASE-1.pptxDATABASE-1.pptx
DATABASE-1.pptx
ManasRanjanRana4
 
Data Base Management System.pdf
Data Base Management System.pdfData Base Management System.pdf
Data Base Management System.pdf
TENZING LHADON
 
ORACLE PL SQL
ORACLE PL SQLORACLE PL SQL
ORACLE PL SQL
Srinath Maharana
 
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
 
SQL Joins Basic and Fundamentals
SQL Joins Basic and FundamentalsSQL Joins Basic and Fundamentals
SQL Joins Basic and Fundamentals
PratikKhodwe1
 
Relational database management system
Relational database management systemRelational database management system
Relational database management system
Praveen Soni
 
SQL SERVER Training in Pune Slides
SQL SERVER Training in Pune SlidesSQL SERVER Training in Pune Slides
SQL SERVER Training in Pune Slides
enosislearningcom
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
Sheethal Aji Mani
 
Introduction to SQL..pdf
Introduction to SQL..pdfIntroduction to SQL..pdf
Introduction to SQL..pdf
mayurisonawane29
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
Abrar ali
 
Data_base.pptx
Data_base.pptxData_base.pptx
Data_base.pptx
Mohit89650
 
RDMS AND SQL
RDMS AND SQLRDMS AND SQL
RDMS AND SQL
milanmehta7
 
05 Create and Maintain Databases and Tables.pptx
05 Create and Maintain Databases and Tables.pptx05 Create and Maintain Databases and Tables.pptx
05 Create and Maintain Databases and Tables.pptx
MohamedNowfeek1
 
SQL interview questions by jeetendra mandal - part 3
SQL interview questions by jeetendra mandal - part 3SQL interview questions by jeetendra mandal - part 3
SQL interview questions by jeetendra mandal - part 3
jeetendra mandal
 
SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2
jeetendra mandal
 

Similar to Sql introduction (20)

Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 
SQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdfSQL -Beginner To Intermediate Level.pdf
SQL -Beginner To Intermediate Level.pdf
 
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
 
SQL
SQLSQL
SQL
 
SQL | DML
SQL | DMLSQL | DML
SQL | DML
 
DATABASE-1.pptx
DATABASE-1.pptxDATABASE-1.pptx
DATABASE-1.pptx
 
Data Base Management System.pdf
Data Base Management System.pdfData Base Management System.pdf
Data Base Management System.pdf
 
ORACLE PL SQL
ORACLE PL SQLORACLE PL SQL
ORACLE PL SQL
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
 
SQL Joins Basic and Fundamentals
SQL Joins Basic and FundamentalsSQL Joins Basic and Fundamentals
SQL Joins Basic and Fundamentals
 
Relational database management system
Relational database management systemRelational database management system
Relational database management system
 
SQL SERVER Training in Pune Slides
SQL SERVER Training in Pune SlidesSQL SERVER Training in Pune Slides
SQL SERVER Training in Pune Slides
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
 
Introduction to SQL..pdf
Introduction to SQL..pdfIntroduction to SQL..pdf
Introduction to SQL..pdf
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 
Data_base.pptx
Data_base.pptxData_base.pptx
Data_base.pptx
 
RDMS AND SQL
RDMS AND SQLRDMS AND SQL
RDMS AND SQL
 
05 Create and Maintain Databases and Tables.pptx
05 Create and Maintain Databases and Tables.pptx05 Create and Maintain Databases and Tables.pptx
05 Create and Maintain Databases and Tables.pptx
 
SQL interview questions by jeetendra mandal - part 3
SQL interview questions by jeetendra mandal - part 3SQL interview questions by jeetendra mandal - part 3
SQL interview questions by jeetendra mandal - part 3
 
SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2SQL interview questions by Jeetendra Mandal - part 2
SQL interview questions by Jeetendra Mandal - part 2
 

More from Bhavya Chawla

Version Control System - for Agile Software Project Management.
Version Control System - for Agile Software Project Management.Version Control System - for Agile Software Project Management.
Version Control System - for Agile Software Project Management.
Bhavya Chawla
 
computer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodecomputer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcode
Bhavya Chawla
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
Bhavya Chawla
 
Ethical Hacking - sniffing
Ethical Hacking - sniffingEthical Hacking - sniffing
Ethical Hacking - sniffing
Bhavya Chawla
 
Employee Management System
Employee Management SystemEmployee Management System
Employee Management System
Bhavya Chawla
 
evolution of computers
 evolution of computers evolution of computers
evolution of computers
Bhavya Chawla
 
the generation of computers
the generation of computersthe generation of computers
the generation of computers
Bhavya Chawla
 

More from Bhavya Chawla (7)

Version Control System - for Agile Software Project Management.
Version Control System - for Agile Software Project Management.Version Control System - for Agile Software Project Management.
Version Control System - for Agile Software Project Management.
 
computer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodecomputer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcode
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Ethical Hacking - sniffing
Ethical Hacking - sniffingEthical Hacking - sniffing
Ethical Hacking - sniffing
 
Employee Management System
Employee Management SystemEmployee Management System
Employee Management System
 
evolution of computers
 evolution of computers evolution of computers
evolution of computers
 
the generation of computers
the generation of computersthe generation of computers
the generation of computers
 

Recently uploaded

ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 

Recently uploaded (20)

ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 

Sql introduction

  • 1.  ANY USEFUL INFORMATION IS A DATA  IN SIMPLE WORDS DATA CAN BE FACTS RELATED TO ANY OBJECT IN CONSIDERATION  FOR EXAMPLE YOUR NAME, AGE, HEIGHT, WEIGHT, ETC. ARE SOME DATA RELATED TO YOU. A PICTURE , IMAGE , FILE , PDF ETC. CAN ALSO BE CONSIDERED DATA What is Data? What is Database?  A database is a systematic collection of data. Databases support storage and manipulation of data. Databases make data management easy  Ex: An online telephone directory
  • 2. WHAT IS A DATABASE MANAGEMENT SYSTEM (DBMS)? • Database Management System (DBMS) is a collection of programs which enables its users to access database, manipulate data, reporting / representation of data . It also helps to control access to the database. • Database Management Systems are not a new concept and as such had been first implemented in 1960s. Charles Bachmen's Integrated Data Store(IDS) is said to be the first DBMS in history
  • 3. TYPES OF DBMS: • Hierarchical - this type of DBMS employs the "parent-child" relationship of storing data. The windows registry used in Windows OS is an example of a hierarchical database. • Network DBMS - this type of DBMS supports many-to many relations. Ex: RDM Server • Relational DBMS - this type of DBMS defines database relationships in form of tables, also known as relations Ex: MySQL, Oracle and Microsoft SQL Server
  • 4. WHAT IS RELATIONAL DATABASE? It is the collection of relations or two dimensional tables Dr E.F Codd proposed the relational model for database system in 1969 Relational Model Consists of following : • Collections of Objects or Relations • Set of Operators to act on the relations • Data integrity for accuracy and consistency. (Data integrity is the one which contains correct data in the database) To Preserve data integrity we have two types: 1.DataType: Data Type is a type of data which you store in each column 2.Constraints
  • 5. CONSTRAINTS: A constraint is a condition which restricts the invalid data in the table. A constraint can be provided for a column of a table. Types of Constraints 1. NOT NULL 2. UNIQUE 3. Primary Key 4. Foreign Key 5. Check
  • 6. NOT NULL - • NULL is nothing, it is neither zero nor blank space. It will not occupy any space in the memory • NOT NULL will ensure at least some value should be present in a column UNIQUE - • It will not allow any duplicates in a column • UNIQUE column can take multiple NULL (s) Primary Key • It is the combination of NOT NULL and UNIQUE • Only one PK is allowed in a table • PK identifies a record uniquely in a table
  • 7. Foreign Key • FK creates relationship between any two tables • FK is created on the child table • FK can take both NULL and duplicate values • We can have more than 1 FK in a given table CHECK • It is used to provide additional validations as per the customer requirements.
  • 8. SQL: • Developed by IBM SQL – Structured Query Language. • SQL – it is a language to talk to the database / to access the database • To work on SQL , a DB software (RDBMS) is required. • SQL is not case sensitive What is SQL? Structured Query language (SQL) pronounced as "S-Q-L" or sometimes as “See-Quel” is actually the standard language for dealing with Relational Databases. SQL can be effectively used to insert, search, update, delete database records.
  • 10. SQL STATEMENTS: SQL SELECT Statement SELECT column1, column2....columnN FROM table_name; SQL WHERE Clause SELECT column1, column2....columnN FROM table_name WHERE CONDITION; SQL> SELECT ID, NAME, SALARY FROM CUSTOMERS; SQL> SELECT ID, NAME, SALARY FROM CUSTOMERS WHERE SALARY > 2000;
  • 11. SQL STATEMENTS: SQL ORDER BY Clause SELECT column1, column2....columnN FROM table_name WHERE CONDITION ORDER BY column_name {ASC|DESC}; SQL GROUP BY Clause SELECT SUM(column_name) FROM table_name WHERE CONDITION GROUP BY column_name; SQL> SELECT * FROM CUSTOMERS ORDER BY NAME, SALARY; SQL> SELECT NAME, SUM(SALARY) FROM CUSTOMERS GROUP BY NAME;
  • 12. SQL STATEMENTS: SQL CREATE TABLE Statement CREATE TABLE table_name( column1 datatype, column2 datatype, column3 datatype, ..... columnN datatype, PRIMARY KEY( one or more columns ) ); SQL DROP TABLE Statement DROP TABLE table_name; SQL> CREATE TABLE CUSTOMERS (ID INT NOT NULL, NAME VARCHAR (20) NOT NULL, AGE INT NOT NULL, ADDRESS CHAR (25), SALARY DECIMAL (18, 2), PRIMARY KEY (ID)); SQL> DROP TABLE CUSTOMERS; SQL> DESC CUSTOMERS; ERROR 1146 (42S02): Table 'TEST.CUSTOMERS' doesn't exist
  • 13. SQL STATEMENTS: SQL TRUNCATE TABLE Statement TRUNCATE TABLE table_name; SQL INSERT INTO Statement INSERT INTO table_name( column1, column2....columnN) VALUES ( value1, value2....valueN); SQL > TRUNCATE TABLE CUSTOMERS; SQL> SELECT * FROM CUSTOMERS; Empty set (0.00 sec) INSERT INTO CUSTOMERS VALUES (7, 'Muffy', 24, 'Indore', 10000.00 );
  • 14. SQL STATEMENTS: SQL UPDATE Statement UPDATE table_name SET column1 = value1, column2 = value2....columnN=valueN [ WHERE CONDITION ]; SQL DELETE Statement DELETE FROM table_name WHERE {CONDITION}; SQL> UPDATE CUSTOMERS SET ADDRESS = 'Pune' WHERE ID = 6; SQL> DELETE FROM CUSTOMERS WHERE ID = 6;
  • 15. SQL JOINS • The SQL Joins clause is used to combine records from two or more tables in a database. A JOIN is a means for combining fields from two tables by using values common to each. There are different types of joins available in SQL − •INNER JOIN − returns rows when there is a match in both tables. •LEFT JOIN − returns all rows from the left table, even if there are no matches in the right table. •RIGHT JOIN − returns all rows from the right table, even if there are no matches in the left table. •FULL JOIN − returns rows when there is a match in one of the tables. •SELF JOIN − is used to join a table to itself as if the table were two tables, temporarily renaming at least one table in the SQL statement.
  • 16. INNER JOIN: SELECT table1.column1, table2.column2... FROM table1 INNER JOIN table2 ON table1.common_field = table2.common_field; SQL> SELECT ID, NAME, AMOUNT, DATE FROM CUSTOMERS INNER JOIN ORDERS ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID;
  • 17. LEFT JOIN: SELECT table1.column1, table2.column2... FROM table1 LEFT JOIN table2 ON table1.common_field = table2.common_field; SQL> SELECT ID, NAME, AMOUNT, DATE FROM CUSTOMERS LEFT JOIN ORDERS ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID;
  • 18. RIGHT JOIN: SELECT table1.column1, table2.column2... FROM table1 RIGHT JOIN table2 ON table1.common_field = table2.common_field; SQL> SELECT ID, NAME, AMOUNT, DATE FROM CUSTOMERS RIGHT JOIN ORDERS ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID;
  • 19. FULL JOIN: SELECT table1.column1, table2.column2... FROM table1 FULL JOIN table2 ON table1.common_field = table2.common_field; SQL> SELECT ID, NAME, AMOUNT, DATE FROM CUSTOMERS FULL JOIN ORDERS ON CUSTOMERS.ID = ORDERS.CUSTOMER_ID;