SlideShare a Scribd company logo
PostgreSQL Tutorial For Beginners | Edureka
TYPES OF DBMS
WHAT IS SQL?
WHAT IS POSTGRESQL?
FEATURES OF POSTGRESQL
SQL COMMAND CATEGORIES
INSTALL POSTGRESQL
www.edureka.co
www.edureka.co
Hierarchical
DBMS
Network
DBMS
Relational
DBMS
Object-
Oriented
DBMS
www.edureka.co
www.edureka.co
A standardized
programming language
which is used for
managing relational
databases.
With SQL, you can
modify databases, add,
update or delete rows
of data, retrieve
subsets of information
from a database and
,any more
Relational databases
like MySQL Databases,
oracle, Ms SQL Server,
Sybase etc use SQL.
Queries and other SQL
operations are written
as statements.
Example: select, insert,
add, update, delete,
create, alter, truncate.
www.edureka.co
www.edureka.co
PostgreSQLis an open-source object relational database
system with a 30+ years of active development in the industry.
World’s Most Advanced Open Source Relational Database
www.edureka.co
www.edureka.co
Data Types Data Integrity Performance
Reliability Security Extensibility
www.edureka.co
www.edureka.co
www.edureka.co
www.edureka.co
.
Transaction Control
Language(TCL)
COMMIT, ROLLBACK,
SAVEPOINT
Data Control
Language(DCL)
GRANT, INVOKE
Data Manipulation
Language(DML)
SELECT, INSERT,
UPDATE, DELETE
CREATE, DROP, ALTER
Data Definition Language
(DDL)
Includes the commands which
mainly deal with the
transaction of database.
Includes commands which
mainly deals with the rights,
permissions and other controls
of the database system.
The SQL commands that deals
with the manipulation of data
present in database.
Consists of the commands that
can be used to define the
database schema.
www.edureka.co
www.edureka.co
www.edureka.co
www.edureka.co
www.edureka.co
Composite vs Simple
Single vs Multivalued
Stored vs Derived
Complex Attributes
ENTITY &
ATTRIBUTES
www.edureka.co
ENTITY &
ATTRIBUTES
Composite vs Simple
A composite attribute can be divided into smaller subparts. These subparts
represent individual basic attributes with their own meanings.
Attributes which are not divisible are simply known as simple or atomic
attributes.
Address
Street _address City State Zip
Number Street House_number
www.edureka.co
ENTITY &
ATTRIBUTES
Composite vs SimpleSingle vs Multivalued
Attributes having single value for a particular entity are known as single-
valued attributes.
A multivalued attribute may have lower and upper bounds to constrain the
number of values allowed for each individual entity.
www.edureka.co
ENTITY &
ATTRIBUTES
Composite vs SimpleSingle vs MultivaluedStored vs Derived
Attributes which are derived from the real entities are known as derived
attributes.
The stored attribute are such attributes which are already stored in the
database and from which the value of another attribute is derived is
called stored attribute.
Age Birth_date
www.edureka.co
ENTITY &
ATTRIBUTES
Composite vs SimpleSingle vs MultivaluedStored vs DerivedComplex Attributes
Attributes that can be represented by grouping composite attributes
between (), separating the components with commas, and by displaying the
multivalued attributes between [] are known as complex attributes.
{Address_phone({Phone(Area_code,Phone_number)},Address(Street_addre
ss{Number,Street, flat_number),City,State,Zip))}
www.edureka.co
www.edureka.co
Candidate
Key
Super
Key
Primary
Key
Alternate
Key
Foreign
Key
www.edureka.co
www.edureka.co
NOT NULL UNIQUE CHECK DEFAULT INDEX
www.edureka.co
Ensures that a NULL
value cannot be
stored in a column
This constraint
makes sure that all
the values in a
column are
different
This constraint
ensures that all the
values in a column
satisfy a specific
condition.
This constraint
consists of a set of
default values for a
column when no
value is specified.
This constraint is
used to create and
retrieve data from
the database very
quickly.
www.edureka.co
CONSTRAINTS IN DATABASE
www.edureka.co
A technique that organizes tables in such a way that redundancy and dependency of data is reduced.
BCNF
3 NF
2 NF
1 NF
www.edureka.co
Salutation Full Name Address Movies Rented Category
Ms. Alice Johnson 1st Street House No 3 Mission Impossible:
Fallout, Clash of Titans
Action, Action
Mr. David Allen 3rd Street 45 Interstellar, Edge Of
Tomorrow
Sci-Fi, Sci-Fi
Mr. David Allen 7th Avenue Mission Impossible:
Fallout
Action
www.edureka.co
NORMALIZATION
First Normal Form
2 NF
3 NF
BCNF
Each table cell should have a single value. So, basically all the records must be unique.
Salutation Full Name Address Movies Rented
Ms. Alice Johnson
1st Street House
No 3
Mission
Impossible: Fallout
Ms. Alice Johnson
1st Street House
No 3
Clash of Titans
Mr. David Allen 3rd Street 45 Interstellar
Mr. David Allen 3rd Street 45 Edge Of Tomorrow
Mr. David Allen 7th Avenue
Mission
Impossible: Fallout
www.edureka.co
NORMALIZATION
3 NF
BCNF
Database should be 1NF and should also have single column primary key.
1 NF
Second Normal Form
Salutation Full Name Address Movies_Rented
ID Salutation Full Name Address
1 Ms Alice
Johnson
1st Street
House No
3
2 Mr David Allen 3rd Street
45
3 Mr David Allen 7th Avenue
ID Movies_Rented
1 Mission Impossible:
Fallout
1 Clash of Titans
2 Interstellar
2 Edge Of Tomorrow
3 Mission Impossible:
Fallout
Table 1
Table 2
www.edureka.co
NORMALIZATION
BCNF
The database should be in 2NF and must not have any transitive functional dependencies.
1 NF
2 NF
Third Normal Form
ID Full Name Address Salutation_ID ID Movies_Rented
Salutation_ID Salutation
1 Mr.
2 Ms.
3 Mrs.
4 Dr.
Table 1 Table 2
Table 3
www.edureka.co
NORMALIZATION
1 NF
2 NF
3 NF
Boyce-Codd Normal
Form
If your database is in 3rd Normal Form, there would be some scenarios where anomalies
would be present, if you have more than candidate key. Then BCNF comes into role, where
you divide your tables further so that there would be only one candidate key present.
www.edureka.co
www.edureka.co
www.edureka.co
ARITHMETIC
OPERATORS
+, -, *, /, %
BITWISE
OPERATORS
&, |, ^
COMPARISON
OPERATORS
==, <, >, <=, >= <>
COMPOUND
OPERATORS
+=, *=, -=, /=,%=,
&=, ^-=, |*=
www.edureka.co
www.edureka.co
Nested queries are SQL queries which have an outer query and inner subquery. The subquery is a query nested within another
query such as SELECT, INSERT, UPDATE or DELETE.
SELECT lastname, firstname
FROM employees
WHERE addressCode IN (SELECT addressCode
FROM office
WHERE country = ā€œINDIAā€)
OUTER QUERY SUBQUERY OR INNER QUERY
www.edureka.co
www.edureka.co
UNION
Combines rows from both
the queries
INTERSECT
Keeps only those rows which
are common in both the
queries.
MINUS
Keeps rows from the left query
which are not included in the
right query
LEFT QUERY RIGHT QUERY FINAL RESULT
www.edureka.co
Copyright Ā© 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
www.edureka.co
www.edureka.co
www.edureka.co
www.edureka.co
JOINS in SQL are commands which are used to combine rows from two or more tables, based on a related column
between those tables. They are predominantly used when a user is trying to extract data from tables which have
one-to-many or many-to-many relationships between them.
What are Joins?
www.edureka.co
TYPES OF
JOINS
INNER JOIN
FULL JOIN
LEFT JOIN
RIGHT JOIN
www.edureka.co
www.edureka.co
A view in SQL is a single table, which is derived from other tables
Query
ROWS
VIEWS
COLUMNS
www.edureka.co
www.edureka.co
www.edureka.co
www.edureka.co
www.edureka.co
www.edureka.co
www.edureka.co
www.edureka.co

More Related Content

PPTX
PostgreSQL Database Slides
metsarin
Ā 
PDF
Get to know PostgreSQL!
OddbjĆørn Steffensen
Ā 
ODP
Introduction to PostgreSQL
Jim Mlodgenski
Ā 
PPTX
Getting started with postgresql
botsplash.com
Ā 
PPTX
PostgreSQL- An Introduction
Smita Prasad
Ā 
PDF
Postgresql tutorial
Ashoka Vanjare
Ā 
PPTX
Postgresql
NexThoughts Technologies
Ā 
ODP
OpenGurukul : Database : PostgreSQL
Open Gurukul
Ā 
PostgreSQL Database Slides
metsarin
Ā 
Get to know PostgreSQL!
OddbjĆørn Steffensen
Ā 
Introduction to PostgreSQL
Jim Mlodgenski
Ā 
Getting started with postgresql
botsplash.com
Ā 
PostgreSQL- An Introduction
Smita Prasad
Ā 
Postgresql tutorial
Ashoka Vanjare
Ā 
OpenGurukul : Database : PostgreSQL
Open Gurukul
Ā 

What's hot (20)

PDF
PostgreSQL Tutorial for Beginners | Edureka
Edureka!
Ā 
PPTX
SQL Queries Information
Nishant Munjal
Ā 
PDF
Postgresql database administration volume 1
Federico Campoli
Ā 
PDF
Integrity constraints in dbms
Vignesh Saravanan
Ā 
PPTX
database language ppt.pptx
Anusha sivakumar
Ā 
PDF
MySQL Tutorial For Beginners | Relational Database Management System | MySQL ...
Edureka!
Ā 
ODP
Ms sql-server
Md.Mojibul Hoque
Ā 
PPTX
trigger dbms
kuldeep100
Ā 
PPTX
Packages in PL/SQL
Pooja Dixit
Ā 
PPTX
Cursors
Priyanka Yadav
Ā 
PDF
Triggers in SQL | Edureka
Edureka!
Ā 
PPT
ADO .Net
DrSonali Vyas
Ā 
PPSX
Functional dependency
Dashani Rajapaksha
Ā 
PPTX
SQL Basics
Hammad Rasheed
Ā 
PPTX
Database Programming Techniques
Raji Ghawi
Ā 
PPTX
NOSQL vs SQL
Mohammed Fazuluddin
Ā 
PPT
Entity Relationship Diagram
Shakila Mahjabin
Ā 
PPTX
Packages in java
Elizabeth alexander
Ā 
PPT
Mysql
TSUBHASHRI
Ā 
PostgreSQL Tutorial for Beginners | Edureka
Edureka!
Ā 
SQL Queries Information
Nishant Munjal
Ā 
Postgresql database administration volume 1
Federico Campoli
Ā 
Integrity constraints in dbms
Vignesh Saravanan
Ā 
database language ppt.pptx
Anusha sivakumar
Ā 
MySQL Tutorial For Beginners | Relational Database Management System | MySQL ...
Edureka!
Ā 
Ms sql-server
Md.Mojibul Hoque
Ā 
trigger dbms
kuldeep100
Ā 
Packages in PL/SQL
Pooja Dixit
Ā 
Cursors
Priyanka Yadav
Ā 
Triggers in SQL | Edureka
Edureka!
Ā 
ADO .Net
DrSonali Vyas
Ā 
Functional dependency
Dashani Rajapaksha
Ā 
SQL Basics
Hammad Rasheed
Ā 
Database Programming Techniques
Raji Ghawi
Ā 
NOSQL vs SQL
Mohammed Fazuluddin
Ā 
Entity Relationship Diagram
Shakila Mahjabin
Ā 
Packages in java
Elizabeth alexander
Ā 
Mysql
TSUBHASHRI
Ā 
Ad

Similar to PostgreSQL Tutorial For Beginners | Edureka (20)

PPTX
429cf300-0dc7-4c2e-9280-d918d69e3cb4.pptx
Harmanjot5678
Ā 
PPTX
T-SQL Overview
Ahmed Elbaz
Ā 
PPTX
Dbms and sqlpptx
thesupermanreturns
Ā 
PDF
dbms final.pdf
RaKesh3868
Ā 
PPTX
Exception & Database
Jamshid Hashimi
Ā 
PPT
Sql1
5h4m4n
Ā 
PPT
Sql server building a database ppt 12
Vibrant Technologies & Computers
Ā 
PPTX
Dbms sql-final
NV Chandra Sekhar Nittala
Ā 
PPTX
structured query language elmarsi and navathe edition 7th SQL Chapter06.pptx
SuryaBasnet3
Ā 
PDF
Introduction to SQL..pdf
mayurisonawane29
Ā 
PPT
D B M S Animate
Indu George
Ā 
PPT
Chapter06.ppt
yashodhaHR2
Ā 
PDF
Oracle SQL Basics
Dhananjay Goel
Ā 
PDF
Lecture05sql 110406195130-phpapp02
Lalit009kumar
Ā 
PPTX
Advance Sqlite3
Raghu nath
Ā 
PPTX
Relational Database Design
Archit Saxena
Ā 
PDF
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Beat Signer
Ā 
PPTX
Data modeling tips from the trenches
Terry Bunio
Ā 
PPTX
Structured Query Language (SQL) _ Edu4Sure Training.pptx
Edu4Sure
Ā 
PPTX
Relational Database Management System
Mian Abdul Raheem
Ā 
429cf300-0dc7-4c2e-9280-d918d69e3cb4.pptx
Harmanjot5678
Ā 
T-SQL Overview
Ahmed Elbaz
Ā 
Dbms and sqlpptx
thesupermanreturns
Ā 
dbms final.pdf
RaKesh3868
Ā 
Exception & Database
Jamshid Hashimi
Ā 
Sql1
5h4m4n
Ā 
Sql server building a database ppt 12
Vibrant Technologies & Computers
Ā 
Dbms sql-final
NV Chandra Sekhar Nittala
Ā 
structured query language elmarsi and navathe edition 7th SQL Chapter06.pptx
SuryaBasnet3
Ā 
Introduction to SQL..pdf
mayurisonawane29
Ā 
D B M S Animate
Indu George
Ā 
Chapter06.ppt
yashodhaHR2
Ā 
Oracle SQL Basics
Dhananjay Goel
Ā 
Lecture05sql 110406195130-phpapp02
Lalit009kumar
Ā 
Advance Sqlite3
Raghu nath
Ā 
Relational Database Design
Archit Saxena
Ā 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Beat Signer
Ā 
Data modeling tips from the trenches
Terry Bunio
Ā 
Structured Query Language (SQL) _ Edu4Sure Training.pptx
Edu4Sure
Ā 
Relational Database Management System
Mian Abdul Raheem
Ā 
Ad

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
Edureka!
Ā 
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
Ā 
PDF
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
Ā 
PDF
Tableau Tutorial for Data Science | Edureka
Edureka!
Ā 
PDF
Python Programming Tutorial | Edureka
Edureka!
Ā 
PDF
Top 5 PMP Certifications | Edureka
Edureka!
Ā 
PDF
Top Maven Interview Questions in 2020 | Edureka
Edureka!
Ā 
PDF
Linux Mint Tutorial | Edureka
Edureka!
Ā 
PDF
How to Deploy Java Web App in AWS| Edureka
Edureka!
Ā 
PDF
Importance of Digital Marketing | Edureka
Edureka!
Ā 
PDF
RPA in 2020 | Edureka
Edureka!
Ā 
PDF
Email Notifications in Jenkins | Edureka
Edureka!
Ā 
PDF
EA Algorithm in Machine Learning | Edureka
Edureka!
Ā 
PDF
Cognitive AI Tutorial | Edureka
Edureka!
Ā 
PDF
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
Ā 
PDF
Blue Prism Top Interview Questions | Edureka
Edureka!
Ā 
PDF
Big Data on AWS Tutorial | Edureka
Edureka!
Ā 
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
Ā 
PDF
Kubernetes Installation on Ubuntu | Edureka
Edureka!
Ā 
PDF
Introduction to DevOps | Edureka
Edureka!
Ā 
What to learn during the 21 days Lockdown | Edureka
Edureka!
Ā 
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
Ā 
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
Ā 
Tableau Tutorial for Data Science | Edureka
Edureka!
Ā 
Python Programming Tutorial | Edureka
Edureka!
Ā 
Top 5 PMP Certifications | Edureka
Edureka!
Ā 
Top Maven Interview Questions in 2020 | Edureka
Edureka!
Ā 
Linux Mint Tutorial | Edureka
Edureka!
Ā 
How to Deploy Java Web App in AWS| Edureka
Edureka!
Ā 
Importance of Digital Marketing | Edureka
Edureka!
Ā 
RPA in 2020 | Edureka
Edureka!
Ā 
Email Notifications in Jenkins | Edureka
Edureka!
Ā 
EA Algorithm in Machine Learning | Edureka
Edureka!
Ā 
Cognitive AI Tutorial | Edureka
Edureka!
Ā 
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
Ā 
Blue Prism Top Interview Questions | Edureka
Edureka!
Ā 
Big Data on AWS Tutorial | Edureka
Edureka!
Ā 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
Ā 
Kubernetes Installation on Ubuntu | Edureka
Edureka!
Ā 
Introduction to DevOps | Edureka
Edureka!
Ā 

Recently uploaded (20)

PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
Ā 
PPTX
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
Ā 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
Ā 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
Ā 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
Ā 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
Ā 
PPTX
Coupa-Overview _Assumptions presentation
annapureddyn
Ā 
PDF
Doc9.....................................
SofiaCollazos
Ā 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
Ā 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
Ā 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
Ā 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
Ā 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
Ā 
PDF
This slide provides an overview Technology
mineshkharadi333
Ā 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
Ā 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
Ā 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
Ā 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
Ā 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
Ā 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
Ā 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
Ā 
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
Ā 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
Ā 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
Ā 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
Ā 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
Ā 
Coupa-Overview _Assumptions presentation
annapureddyn
Ā 
Doc9.....................................
SofiaCollazos
Ā 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
Ā 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
Ā 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
Ā 
cloud computing vai.pptx for the project
vaibhavdobariyal79
Ā 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
Ā 
This slide provides an overview Technology
mineshkharadi333
Ā 
Presentation about Hardware and Software in Computer
snehamodhawadiya
Ā 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
Ā 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
Ā 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
Ā 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
Ā 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
Ā 

PostgreSQL Tutorial For Beginners | Edureka

  • 2. TYPES OF DBMS WHAT IS SQL? WHAT IS POSTGRESQL? FEATURES OF POSTGRESQL SQL COMMAND CATEGORIES INSTALL POSTGRESQL www.edureka.co
  • 6. A standardized programming language which is used for managing relational databases. With SQL, you can modify databases, add, update or delete rows of data, retrieve subsets of information from a database and ,any more Relational databases like MySQL Databases, oracle, Ms SQL Server, Sybase etc use SQL. Queries and other SQL operations are written as statements. Example: select, insert, add, update, delete, create, alter, truncate. www.edureka.co
  • 8. PostgreSQLis an open-source object relational database system with a 30+ years of active development in the industry. World’s Most Advanced Open Source Relational Database www.edureka.co
  • 10. Data Types Data Integrity Performance Reliability Security Extensibility www.edureka.co
  • 13. . Transaction Control Language(TCL) COMMIT, ROLLBACK, SAVEPOINT Data Control Language(DCL) GRANT, INVOKE Data Manipulation Language(DML) SELECT, INSERT, UPDATE, DELETE CREATE, DROP, ALTER Data Definition Language (DDL) Includes the commands which mainly deal with the transaction of database. Includes commands which mainly deals with the rights, permissions and other controls of the database system. The SQL commands that deals with the manipulation of data present in database. Consists of the commands that can be used to define the database schema. www.edureka.co
  • 18. Composite vs Simple Single vs Multivalued Stored vs Derived Complex Attributes ENTITY & ATTRIBUTES www.edureka.co
  • 19. ENTITY & ATTRIBUTES Composite vs Simple A composite attribute can be divided into smaller subparts. These subparts represent individual basic attributes with their own meanings. Attributes which are not divisible are simply known as simple or atomic attributes. Address Street _address City State Zip Number Street House_number www.edureka.co
  • 20. ENTITY & ATTRIBUTES Composite vs SimpleSingle vs Multivalued Attributes having single value for a particular entity are known as single- valued attributes. A multivalued attribute may have lower and upper bounds to constrain the number of values allowed for each individual entity. www.edureka.co
  • 21. ENTITY & ATTRIBUTES Composite vs SimpleSingle vs MultivaluedStored vs Derived Attributes which are derived from the real entities are known as derived attributes. The stored attribute are such attributes which are already stored in the database and from which the value of another attribute is derived is called stored attribute. Age Birth_date www.edureka.co
  • 22. ENTITY & ATTRIBUTES Composite vs SimpleSingle vs MultivaluedStored vs DerivedComplex Attributes Attributes that can be represented by grouping composite attributes between (), separating the components with commas, and by displaying the multivalued attributes between [] are known as complex attributes. {Address_phone({Phone(Area_code,Phone_number)},Address(Street_addre ss{Number,Street, flat_number),City,State,Zip))} www.edureka.co
  • 26. NOT NULL UNIQUE CHECK DEFAULT INDEX www.edureka.co Ensures that a NULL value cannot be stored in a column This constraint makes sure that all the values in a column are different This constraint ensures that all the values in a column satisfy a specific condition. This constraint consists of a set of default values for a column when no value is specified. This constraint is used to create and retrieve data from the database very quickly. www.edureka.co CONSTRAINTS IN DATABASE
  • 28. A technique that organizes tables in such a way that redundancy and dependency of data is reduced. BCNF 3 NF 2 NF 1 NF www.edureka.co
  • 29. Salutation Full Name Address Movies Rented Category Ms. Alice Johnson 1st Street House No 3 Mission Impossible: Fallout, Clash of Titans Action, Action Mr. David Allen 3rd Street 45 Interstellar, Edge Of Tomorrow Sci-Fi, Sci-Fi Mr. David Allen 7th Avenue Mission Impossible: Fallout Action www.edureka.co
  • 30. NORMALIZATION First Normal Form 2 NF 3 NF BCNF Each table cell should have a single value. So, basically all the records must be unique. Salutation Full Name Address Movies Rented Ms. Alice Johnson 1st Street House No 3 Mission Impossible: Fallout Ms. Alice Johnson 1st Street House No 3 Clash of Titans Mr. David Allen 3rd Street 45 Interstellar Mr. David Allen 3rd Street 45 Edge Of Tomorrow Mr. David Allen 7th Avenue Mission Impossible: Fallout www.edureka.co
  • 31. NORMALIZATION 3 NF BCNF Database should be 1NF and should also have single column primary key. 1 NF Second Normal Form Salutation Full Name Address Movies_Rented ID Salutation Full Name Address 1 Ms Alice Johnson 1st Street House No 3 2 Mr David Allen 3rd Street 45 3 Mr David Allen 7th Avenue ID Movies_Rented 1 Mission Impossible: Fallout 1 Clash of Titans 2 Interstellar 2 Edge Of Tomorrow 3 Mission Impossible: Fallout Table 1 Table 2 www.edureka.co
  • 32. NORMALIZATION BCNF The database should be in 2NF and must not have any transitive functional dependencies. 1 NF 2 NF Third Normal Form ID Full Name Address Salutation_ID ID Movies_Rented Salutation_ID Salutation 1 Mr. 2 Ms. 3 Mrs. 4 Dr. Table 1 Table 2 Table 3 www.edureka.co
  • 33. NORMALIZATION 1 NF 2 NF 3 NF Boyce-Codd Normal Form If your database is in 3rd Normal Form, there would be some scenarios where anomalies would be present, if you have more than candidate key. Then BCNF comes into role, where you divide your tables further so that there would be only one candidate key present. www.edureka.co
  • 36. ARITHMETIC OPERATORS +, -, *, /, % BITWISE OPERATORS &, |, ^ COMPARISON OPERATORS ==, <, >, <=, >= <> COMPOUND OPERATORS +=, *=, -=, /=,%=, &=, ^-=, |*= www.edureka.co
  • 38. Nested queries are SQL queries which have an outer query and inner subquery. The subquery is a query nested within another query such as SELECT, INSERT, UPDATE or DELETE. SELECT lastname, firstname FROM employees WHERE addressCode IN (SELECT addressCode FROM office WHERE country = ā€œINDIAā€) OUTER QUERY SUBQUERY OR INNER QUERY www.edureka.co
  • 40. UNION Combines rows from both the queries INTERSECT Keeps only those rows which are common in both the queries. MINUS Keeps rows from the left query which are not included in the right query LEFT QUERY RIGHT QUERY FINAL RESULT www.edureka.co
  • 41. Copyright Ā© 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co
  • 46. JOINS in SQL are commands which are used to combine rows from two or more tables, based on a related column between those tables. They are predominantly used when a user is trying to extract data from tables which have one-to-many or many-to-many relationships between them. What are Joins? www.edureka.co
  • 47. TYPES OF JOINS INNER JOIN FULL JOIN LEFT JOIN RIGHT JOIN www.edureka.co
  • 49. A view in SQL is a single table, which is derived from other tables Query ROWS VIEWS COLUMNS www.edureka.co