SlideShare une entreprise Scribd logo
1  sur  18
Welcome to our Presentation
Topic: E-R diagram & SQL
Presented by:
The roll of 20, 22, 23, 30 & 38
Batch: E-56
Dhaka International University (DIU)
Entity Relationship Diagram (ERD)
An Entity Relationship Diagram (ERD) is a snapshot of data
structures. An Entity Relationship Diagram shows entities
(tables) in a database and relationships between tables within
that database. For a good database design it is essential to
have an Entity Relationship Diagram.
There are three basic elements in ER-Diagrams:
 Entities are the "things" for which we want to store information.
An entity is a person, place, thing or event.
 Attributes are the data we want to collect for an entity.
 Relationships describe the relations between the entities.
Symbol used in E-R diagram
 Rectangles: Represent entity sets.
 Diamonds: Represent relationship sets.
 Lines: Link attributes to entity sets and entity sets to relationship sets.
 Ellipses: Represent attributes.
 Double ellipses: Represent multi-valued attributes.
 Dashed ellipses: Denote derived attributes.
 Underline: Indicates primary key attributes. (Describe later)
E-R Diagram With Composite,
Multi-valued and Derived
Attributes
Mapping Cardinality & Constraints
Mapping Cardinality:
 Express the number of entities to which
another entity can be associated via a
relationship set.
 Most useful in describing binary relationship
sets.
For a binary relationship set the mapping
cardinality must be one of the following types:
 One to many
 One to one
 Many to one
 Many to many
Cardinality & Constraints:
We express cardinality constraints by drawing
either a directed line (→), signifying “one,” or an
undirected line (—), signifying “many,” between
the relationship set and the entity set.
 One-to-One
 A customer is associated with at most one
loan via the relationship borrower
 A loan is associated with at most one
customer via borrower
 One-to- Many
 In the one-to-many relationship a loan is
associated with at most one customer via
borrower, a customer is associated with
several (including 0) loans via borrower
 Many-to-One
 In a many-to-one relationship a loan is
associated with several (including 0) customers
via borrower, a customer is associated with at
most one loan via borrower
 Many-to- Many
 A customer is associated with several (possibly 0)
loans via borrower
 A loan is associated with several (possibly 0)
customers via borrower
Alternative Notation for
Cardinality Limits
Participation of an Entity Set in a
Relationship Set
Keys
Primary Key – A primary is a column or set of columns in a table that uniquely identifies tuples
(rows) in that table.
Super Key – A super key is a set of one of more columns (attributes) to uniquely identify rows
in a table.
Candidate Key – A super key with no redundant attribute is known as candidate key.
Foreign Key – Foreign keys are the columns of a table that points to the primary key of another
table. They act as a cross-reference between tables.
Structured Query Language(SQL)
What is SQL?
SQL (pronounced "ess-que-el") stands for Structured Query Language.
SQL is used to communicate with a database. According to ANSI
(American National Standards Institute), it is the standard language for
relational database management systems. SQL statements are used to
perform tasks such as update data on a database, or retrieve data from a
database. Some common relational database management systems that
use SQL are:
 Oracle
 Microsoft SQL Server
 MySQL, etc. (We describe MySQL here.)
Although most database systems use SQL, most of them also have their
own additional proprietary extensions that are usually only used on their
system. However, the standard SQL commands such as "Select",
"Insert", "Update", "Delete", "Create", and "Drop" can be used to
MySQL
MySQL: MySQL is a fast, easy-to-use RDBMS being used for many small and big
businesses. MySQL is becoming so popular because of many good reasons :−
 MySQL is released under an open-source license. So we have nothing to pay to use it.
 MySQL is a very powerful program in its own right. It handles a large subset of the
functionality of the most expensive and powerful database packages.
 MySQL uses a standard form of the well-known SQL data language.
 MySQL works on many operating systems and with many languages including PHP,
PERL, C, C++, JAVA, etc.
 MySQL works very quickly and works well even with large data sets.
 MySQL is very friendly to PHP, the most appreciated language for web development.
 MySQL supports large databases, up to 50 million rows or more in a table. The default
file size limit for a table is 4GB, but you can increase this (if your operating system can
handle it) to a theoretical limit of 8 million terabytes (TB).
 MySQL is customizable. The open-source GPL license allows programmers to modify the
MySQL software to fit their own specific environments.
MySQL Commands
Create & Show database: Use database:
Create table:
MySQL Commands
Show table list: Show table structure:
Insert values in a table: Shows all data of a table:
MySQL Commands
We have already created a table to the name
of student to show the ALTER and SELECT
operation of MySQL database. The table is :-
Add address column into student table.
Drop address column from student table.
Drop primary key from student table.
MySQL Commands
Add primary key into student table. Select all data from student table.
Seelect only roll & name from student table.
Select roll & name where age > 18 from
student table.
MySQL Commands
AUTO_INCREMENT property into id field of test table. Define an initial value of id (AUTO_INCREMENT) field of
test table.
We have created two tables to the name of loan and borrower to show the Cartesian table operation of
MySQL database and inserted some data in those tables.
MySQL Commands
Cartesian table operation: Shows all data from loan
and borrower table where loan.loan_no is equal to
borrower.loan_no (and amount > 1500).
String Operation: We have created a table to the
name of customer to show the String operation of
MySQL database and inserted some data in the table.
String Operation
Find the name of all customer
whose name start with ‘IBR’
Find the name of all customer
whose name end with ‘him’
Find the name of all customer
whose name contain ‘man’
Find the name of all customer whose
name second character ‘b’
Find the name of all customer whose name start with ‘Mon’ and
end with ‘man’
Have you any question
E-R diagram & SQL

Contenu connexe

Tendances

Tendances (20)

Joins
Joins Joins
Joins
 
Degree of relationship set
Degree of relationship setDegree of relationship set
Degree of relationship set
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Advanced sql
Advanced sqlAdvanced sql
Advanced sql
 
SQL Queries
SQL QueriesSQL Queries
SQL Queries
 
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFNormalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
 
SQL subquery
SQL subquerySQL subquery
SQL subquery
 
Advanced Sql Training
Advanced Sql TrainingAdvanced Sql Training
Advanced Sql Training
 
Database normalization
Database normalizationDatabase normalization
Database normalization
 
Entity relationship modelling
Entity relationship modellingEntity relationship modelling
Entity relationship modelling
 
Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
SQL Joins.pptx
SQL Joins.pptxSQL Joins.pptx
SQL Joins.pptx
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Types of keys dbms
Types of keys dbmsTypes of keys dbms
Types of keys dbms
 
Sql subquery
Sql  subquerySql  subquery
Sql subquery
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Dbms 4NF & 5NF
Dbms 4NF & 5NFDbms 4NF & 5NF
Dbms 4NF & 5NF
 
Database : Relational Data Model
Database : Relational Data ModelDatabase : Relational Data Model
Database : Relational Data Model
 

Similaire à E-R diagram & SQL

COMPUTERS Database
COMPUTERS Database COMPUTERS Database
COMPUTERS Database Rc Os
 
Islamic University Previous Year Question Solution 2019 (ADBMS)
Islamic University Previous Year Question Solution 2019 (ADBMS)Islamic University Previous Year Question Solution 2019 (ADBMS)
Islamic University Previous Year Question Solution 2019 (ADBMS)Rakibul Hasan Pranto
 
Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013Prosanta Ghosh
 
Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01Ankit Dubey
 
Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01Ankit Dubey
 
GROUP-4-Database-Connectivity-with-MySqL.pptx
GROUP-4-Database-Connectivity-with-MySqL.pptxGROUP-4-Database-Connectivity-with-MySqL.pptx
GROUP-4-Database-Connectivity-with-MySqL.pptxJohnLhoydMaderable
 
Week 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data ModelWeek 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data Modeloudesign
 
Relational Database Management System part II
Relational Database Management System part IIRelational Database Management System part II
Relational Database Management System part IIKavithaA19
 
Steps towards of sql server developer
Steps towards of sql server developerSteps towards of sql server developer
Steps towards of sql server developerAhsan Kabir
 
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQLDATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQLDev Chauhan
 
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 knowPavithSingh
 
Relational data model
Relational data modelRelational data model
Relational data modelSURBHI SAROHA
 

Similaire à E-R diagram & SQL (20)

COMPUTERS Database
COMPUTERS Database COMPUTERS Database
COMPUTERS Database
 
Islamic University Previous Year Question Solution 2019 (ADBMS)
Islamic University Previous Year Question Solution 2019 (ADBMS)Islamic University Previous Year Question Solution 2019 (ADBMS)
Islamic University Previous Year Question Solution 2019 (ADBMS)
 
Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013Dbms ii mca-ch4-relational model-2013
Dbms ii mca-ch4-relational model-2013
 
The Smartpath Information Systems | BASIC RDBMS CONCEPTS
The Smartpath Information Systems | BASIC RDBMS CONCEPTSThe Smartpath Information Systems | BASIC RDBMS CONCEPTS
The Smartpath Information Systems | BASIC RDBMS CONCEPTS
 
Databases
DatabasesDatabases
Databases
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
RDBMS
RDBMSRDBMS
RDBMS
 
Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01
 
Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01Sm relationaldatamodel-150423084157-conversion-gate01
Sm relationaldatamodel-150423084157-conversion-gate01
 
GROUP-4-Database-Connectivity-with-MySqL.pptx
GROUP-4-Database-Connectivity-with-MySqL.pptxGROUP-4-Database-Connectivity-with-MySqL.pptx
GROUP-4-Database-Connectivity-with-MySqL.pptx
 
Week 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data ModelWeek 4 The Relational Data Model & The Entity Relationship Data Model
Week 4 The Relational Data Model & The Entity Relationship Data Model
 
sql_data.pdf
sql_data.pdfsql_data.pdf
sql_data.pdf
 
RDBMS
RDBMSRDBMS
RDBMS
 
Relational Database Management System part II
Relational Database Management System part IIRelational Database Management System part II
Relational Database Management System part II
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
Steps towards of sql server developer
Steps towards of sql server developerSteps towards of sql server developer
Steps towards of sql server developer
 
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQLDATABASE MANAGMENT SYSTEM (DBMS) AND SQL
DATABASE MANAGMENT SYSTEM (DBMS) AND SQL
 
Fg d
Fg dFg d
Fg d
 
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
 
Relational data model
Relational data modelRelational data model
Relational data model
 

Dernier

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxdhanalakshmis0310
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 

Dernier (20)

Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 

E-R diagram & SQL

  • 1. Welcome to our Presentation Topic: E-R diagram & SQL Presented by: The roll of 20, 22, 23, 30 & 38 Batch: E-56 Dhaka International University (DIU)
  • 2. Entity Relationship Diagram (ERD) An Entity Relationship Diagram (ERD) is a snapshot of data structures. An Entity Relationship Diagram shows entities (tables) in a database and relationships between tables within that database. For a good database design it is essential to have an Entity Relationship Diagram. There are three basic elements in ER-Diagrams:  Entities are the "things" for which we want to store information. An entity is a person, place, thing or event.  Attributes are the data we want to collect for an entity.  Relationships describe the relations between the entities.
  • 3. Symbol used in E-R diagram  Rectangles: Represent entity sets.  Diamonds: Represent relationship sets.  Lines: Link attributes to entity sets and entity sets to relationship sets.  Ellipses: Represent attributes.  Double ellipses: Represent multi-valued attributes.  Dashed ellipses: Denote derived attributes.  Underline: Indicates primary key attributes. (Describe later)
  • 4. E-R Diagram With Composite, Multi-valued and Derived Attributes Mapping Cardinality & Constraints Mapping Cardinality:  Express the number of entities to which another entity can be associated via a relationship set.  Most useful in describing binary relationship sets. For a binary relationship set the mapping cardinality must be one of the following types:  One to many  One to one  Many to one  Many to many Cardinality & Constraints: We express cardinality constraints by drawing either a directed line (→), signifying “one,” or an undirected line (—), signifying “many,” between the relationship set and the entity set.
  • 5.  One-to-One  A customer is associated with at most one loan via the relationship borrower  A loan is associated with at most one customer via borrower  One-to- Many  In the one-to-many relationship a loan is associated with at most one customer via borrower, a customer is associated with several (including 0) loans via borrower
  • 6.  Many-to-One  In a many-to-one relationship a loan is associated with several (including 0) customers via borrower, a customer is associated with at most one loan via borrower  Many-to- Many  A customer is associated with several (possibly 0) loans via borrower  A loan is associated with several (possibly 0) customers via borrower
  • 7. Alternative Notation for Cardinality Limits Participation of an Entity Set in a Relationship Set Keys Primary Key – A primary is a column or set of columns in a table that uniquely identifies tuples (rows) in that table. Super Key – A super key is a set of one of more columns (attributes) to uniquely identify rows in a table. Candidate Key – A super key with no redundant attribute is known as candidate key. Foreign Key – Foreign keys are the columns of a table that points to the primary key of another table. They act as a cross-reference between tables.
  • 8. Structured Query Language(SQL) What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate with a database. According to ANSI (American National Standards Institute), it is the standard language for relational database management systems. SQL statements are used to perform tasks such as update data on a database, or retrieve data from a database. Some common relational database management systems that use SQL are:  Oracle  Microsoft SQL Server  MySQL, etc. (We describe MySQL here.) Although most database systems use SQL, most of them also have their own additional proprietary extensions that are usually only used on their system. However, the standard SQL commands such as "Select", "Insert", "Update", "Delete", "Create", and "Drop" can be used to
  • 9. MySQL MySQL: MySQL is a fast, easy-to-use RDBMS being used for many small and big businesses. MySQL is becoming so popular because of many good reasons :−  MySQL is released under an open-source license. So we have nothing to pay to use it.  MySQL is a very powerful program in its own right. It handles a large subset of the functionality of the most expensive and powerful database packages.  MySQL uses a standard form of the well-known SQL data language.  MySQL works on many operating systems and with many languages including PHP, PERL, C, C++, JAVA, etc.  MySQL works very quickly and works well even with large data sets.  MySQL is very friendly to PHP, the most appreciated language for web development.  MySQL supports large databases, up to 50 million rows or more in a table. The default file size limit for a table is 4GB, but you can increase this (if your operating system can handle it) to a theoretical limit of 8 million terabytes (TB).  MySQL is customizable. The open-source GPL license allows programmers to modify the MySQL software to fit their own specific environments.
  • 10. MySQL Commands Create & Show database: Use database: Create table:
  • 11. MySQL Commands Show table list: Show table structure: Insert values in a table: Shows all data of a table:
  • 12. MySQL Commands We have already created a table to the name of student to show the ALTER and SELECT operation of MySQL database. The table is :- Add address column into student table. Drop address column from student table. Drop primary key from student table.
  • 13. MySQL Commands Add primary key into student table. Select all data from student table. Seelect only roll & name from student table. Select roll & name where age > 18 from student table.
  • 14. MySQL Commands AUTO_INCREMENT property into id field of test table. Define an initial value of id (AUTO_INCREMENT) field of test table. We have created two tables to the name of loan and borrower to show the Cartesian table operation of MySQL database and inserted some data in those tables.
  • 15. MySQL Commands Cartesian table operation: Shows all data from loan and borrower table where loan.loan_no is equal to borrower.loan_no (and amount > 1500). String Operation: We have created a table to the name of customer to show the String operation of MySQL database and inserted some data in the table.
  • 16. String Operation Find the name of all customer whose name start with ‘IBR’ Find the name of all customer whose name end with ‘him’ Find the name of all customer whose name contain ‘man’ Find the name of all customer whose name second character ‘b’ Find the name of all customer whose name start with ‘Mon’ and end with ‘man’
  • 17. Have you any question