SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Relational Data Model
BY:SURBHI SAROHA
SYLLABUS
Relational Database
Relational Algebra
Structured Query Language(SQL)
Relational Database
 A relational database is a type of database.
 It uses a structure that allows us to identify and access data in relation to
another piece of data in the database.
 Often, data in a relational database is organized into tables.
 Tables: Rows and Columns
 Tables can have hundreds, thousands, sometimes even millions of rows of
data. These rows are often called records.
 Tables can also have many columns of data. Columns are labeled with a
descriptive name (say, age for example) and have a specific data type.
 For example, a column called age may have a type of INTEGER (denoting the
type of data it is meant to hold).
Cont….
Cont…
 In the table above, there are three columns (name, age, and country).
 The name and country columns store string data types, whereas age stores
integer data types.
 The set of columns and data types make up the schema of this table.
 The table also has four rows, or records, in it (one each for Natalia, Ned,
Zenas, and Laura).
 What is a Relational Database Management System (RDBMS)?
 A relational database management system (RDBMS) is a program that allows
you to create, update, and administer a relational database. Most relational
database management systems use the SQL language to access the database.
Relational Algebra
 Relational database systems are expected to be equipped with a query
language that can assist its users to query the database instances. There are
two kinds of query languages − relational algebra and relational calculus.
 Relational Algebra
 Relational algebra is a procedural query language, which takes instances of
relations as input and yields instances of relations as output.
 It uses operators to perform queries. An operator can be
either unary or binary.
 They accept relations as their input and yield relations as their output.
 Relational algebra is performed recursively on a relation and intermediate
results are also considered relations.
Cont….
 The fundamental operations of relational algebra are as follows −
 Select
 Project
 Union
 Set different
 Cartesian product
 Rename
Select Operation (σ)
 It selects tuples that satisfy the given predicate from a relation.
 Notation − σp(r)
 Where σ stands for selection predicate and r stands for relation. p is prepositional logic
formula which may use connectors like and, or, and not. These terms may use relational
operators like − =, ≠, ≥, < , >, ≤.
 For example −
 σsubject = "database"(Books)
 Output − Selects tuples from books where subject is 'database'.
 σsubject = "database" and price = "450"(Books)
 Output − Selects tuples from books where subject is 'database' and 'price' is 450.
 σsubject = "database" and price = "450" or year > "2010"(Books)
 Output − Selects tuples from books where subject is 'database' and 'price' is 450 or those
books published after 2010.
Project Operation (∏)
 It projects column(s) that satisfy a given predicate.
 Notation − ∏A1, A2, An (r)
 Where A1, A2 , An are attribute names of relation r.
 Duplicate rows are automatically eliminated, as relation is a set.
 For example −
 ∏subject, author (Books)
 Selects and projects columns named as subject and author from the relation
Books.
 Union Operation (∪)
 It performs binary union between two given relations and is defined as −
Cont….
 r ∪ s = { t | t ∈ r or t ∈ s}
 Notation − r U s
 Where r and s are either database relations or relation result set (temporary
relation).
 For a union operation to be valid, the following conditions must hold −
 r, and s must have the same number of attributes.
 Attribute domains must be compatible.
 Duplicate tuples are automatically eliminated.
 ∏ author (Books) ∪ ∏ author (Articles)
 Output − Projects the names of the authors who have either written a book or an
article or both.
Set Difference (−)
 The result of set difference operation is tuples, which are present in one
relation but are not in the second relation.
 Notation − r − s
 Finds all the tuples that are present in r but not in s.
 ∏ author (Books) − ∏ author (Articles)
 Output − Provides the name of authors who have written books but not
articles.
 Cartesian Product (Χ)
 Combines information of two different relations into one.
Cont….
 Notation − r Χ s
 Where r and s are relations and their output will be defined as −
 r Χ s = { q t | q ∈ r and t ∈ s}
 σauthor = 'tutorialspoint'(Books Χ Articles)
 Output − Yields a relation, which shows all the books and articles written by
tutorialspoint.
Rename Operation (ρ)
 The results of relational algebra are also relations but without any name. The
rename operation allows us to rename the output relation. 'rename' operation
is denoted with small Greek letter rho ρ.
 Notation − ρ x (E)
 Where the result of expression E is saved with name of x.
 Additional operations are −
 Set intersection
 Assignment
 Natural join
Structured Query Language(SQL)
 SQL is a standard language for accessing and manipulating databases.
 What is SQL?
 SQL stands for Structured Query Language
 SQL lets you access and manipulate databases
 SQL became a standard of the American National Standards Institute (ANSI) in
1986, and of the International Organization for Standardization (ISO) in 1987.
 Although SQL is an ANSI/ISO standard, there are different versions of the SQL
language.
 However, to be compliant with the ANSI standard, they all support at least the
major commands (such as SELECT, UPDATE, DELETE, INSERT, WHERE) in a
similar manner.
What Can SQL do?
 SQL can execute queries against a database
 SQL can retrieve data from a database
 SQL can insert records in a database
 SQL can update records in a database
 SQL can delete records from a database
 SQL can create new databases
 SQL can create new tables in a database
 SQL can create stored procedures in a database
 SQL can create views in a database
 SQL can set permissions on tables, procedures, and views
Using SQL in Your Web Site
 To build a web site that shows data from a database, you will need:
 An RDBMS database program (i.e. MS Access, SQL Server, MySQL)
 To use a server-side scripting language, like PHP or ASP
 To use SQL to get the data you want
 To use HTML / CSS to style the page
RDBMS
 RDBMS stands for Relational Database Management System.
 RDBMS is the basis for SQL, and for all modern database systems such as MS
SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.
 The data in RDBMS is stored in database objects called tables. A table is a
collection of related data entries and it consists of columns and rows.
 Look at the "Customers" table:
 Example
 SELECT * FROM Customers;
Some of The Most Important 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
The SQL SELECT Statement
 The SELECT statement is used to select data from a database.
 The data returned is stored in a result table, called the result-set.
 SELECT Syntax
 SELECT column1, column2, ...
 FROM table_name;
 Here, column1, column2, ... are the field names of the table you want to
select data from. If you want to select all the fields available in the table,
use the following syntax:
 SELECT * FROM table_name;
THANK YOU

Weitere ähnliche Inhalte

Was ist angesagt?

Overview of Storage and Indexing ...
Overview of Storage and Indexing                                             ...Overview of Storage and Indexing                                             ...
Overview of Storage and Indexing ...Javed Khan
 
History of database processing module 1 (2)
History of database processing module 1 (2)History of database processing module 1 (2)
History of database processing module 1 (2)chottu89
 
FIle Organization.pptx
FIle Organization.pptxFIle Organization.pptx
FIle Organization.pptxSreenivas R
 
Data Structure and its Fundamentals
Data Structure and its FundamentalsData Structure and its Fundamentals
Data Structure and its FundamentalsHitesh Mohapatra
 
Database Keys & Relationship
Database Keys & RelationshipDatabase Keys & Relationship
Database Keys & RelationshipBellal Hossain
 
Ficheros con organización secuencial indexada encadenada
Ficheros con organización secuencial indexada encadenadaFicheros con organización secuencial indexada encadenada
Ficheros con organización secuencial indexada encadenadaFportavella
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a DatabaseBishrul Haq
 
Different type of databases
Different type of databasesDifferent type of databases
Different type of databasesShwe Yee
 
Indexing structure for files
Indexing structure for filesIndexing structure for files
Indexing structure for filesZainab Almugbel
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfChristalin Nelson
 
File organization 1
File organization 1File organization 1
File organization 1Rupali Rana
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database DesignArchit Saxena
 

Was ist angesagt? (20)

Overview of Storage and Indexing ...
Overview of Storage and Indexing                                             ...Overview of Storage and Indexing                                             ...
Overview of Storage and Indexing ...
 
History of database processing module 1 (2)
History of database processing module 1 (2)History of database processing module 1 (2)
History of database processing module 1 (2)
 
FIle Organization.pptx
FIle Organization.pptxFIle Organization.pptx
FIle Organization.pptx
 
Parallel databases
Parallel databasesParallel databases
Parallel databases
 
Normalization
NormalizationNormalization
Normalization
 
Data Structure and its Fundamentals
Data Structure and its FundamentalsData Structure and its Fundamentals
Data Structure and its Fundamentals
 
Database Keys & Relationship
Database Keys & RelationshipDatabase Keys & Relationship
Database Keys & Relationship
 
Database Management Systems
Database Management SystemsDatabase Management Systems
Database Management Systems
 
Ficheros con organización secuencial indexada encadenada
Ficheros con organización secuencial indexada encadenadaFicheros con organización secuencial indexada encadenada
Ficheros con organización secuencial indexada encadenada
 
Normalization in a Database
Normalization in a DatabaseNormalization in a Database
Normalization in a Database
 
Different type of databases
Different type of databasesDifferent type of databases
Different type of databases
 
Indexing structure for files
Indexing structure for filesIndexing structure for files
Indexing structure for files
 
DDBMS
DDBMSDDBMS
DDBMS
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdf
 
File organization 1
File organization 1File organization 1
File organization 1
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 
Advanced Database System
Advanced Database SystemAdvanced Database System
Advanced Database System
 
Lec 1 indexing and hashing
Lec 1 indexing and hashing Lec 1 indexing and hashing
Lec 1 indexing and hashing
 
Partitioning
PartitioningPartitioning
Partitioning
 
Dimensional Modelling
Dimensional ModellingDimensional Modelling
Dimensional Modelling
 

Ähnlich wie Relational data model (20)

Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
COMPUTERS Database
COMPUTERS Database COMPUTERS Database
COMPUTERS Database
 
Relational Algebra Operations
Relational Algebra OperationsRelational Algebra Operations
Relational Algebra Operations
 
Ch9
Ch9Ch9
Ch9
 
Sql
SqlSql
Sql
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
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
 
Sql.pptx
Sql.pptxSql.pptx
Sql.pptx
 
SQL select statement and functions
SQL select statement and functionsSQL select statement and functions
SQL select statement and functions
 
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
 
DBMS UNIT 3
DBMS UNIT 3DBMS UNIT 3
DBMS UNIT 3
 
RDBMS BY DANISH SHAFI MIR.pptx
RDBMS BY DANISH SHAFI MIR.pptxRDBMS BY DANISH SHAFI MIR.pptx
RDBMS BY DANISH SHAFI MIR.pptx
 
Relational model
Relational modelRelational model
Relational model
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 
DDL and DML statements.pptx
DDL and DML statements.pptxDDL and DML statements.pptx
DDL and DML statements.pptx
 
Databases
DatabasesDatabases
Databases
 
Module 3
Module 3Module 3
Module 3
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
Collection
Collection Collection
Collection
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 

Mehr von SURBHI SAROHA

Cloud Computing (Infrastructure as a Service)UNIT 2
Cloud Computing (Infrastructure as a Service)UNIT 2Cloud Computing (Infrastructure as a Service)UNIT 2
Cloud Computing (Infrastructure as a Service)UNIT 2SURBHI SAROHA
 
Management Information System(Unit 2).pptx
Management Information System(Unit 2).pptxManagement Information System(Unit 2).pptx
Management Information System(Unit 2).pptxSURBHI SAROHA
 
Searching in Data Structure(Linear search and Binary search)
Searching in Data Structure(Linear search and Binary search)Searching in Data Structure(Linear search and Binary search)
Searching in Data Structure(Linear search and Binary search)SURBHI SAROHA
 
Management Information System(UNIT 1).pptx
Management Information System(UNIT 1).pptxManagement Information System(UNIT 1).pptx
Management Information System(UNIT 1).pptxSURBHI SAROHA
 
Introduction to Cloud Computing(UNIT 1).pptx
Introduction to Cloud Computing(UNIT 1).pptxIntroduction to Cloud Computing(UNIT 1).pptx
Introduction to Cloud Computing(UNIT 1).pptxSURBHI SAROHA
 
Keys in dbms(UNIT 2)
Keys in dbms(UNIT 2)Keys in dbms(UNIT 2)
Keys in dbms(UNIT 2)SURBHI SAROHA
 
Database Management System(UNIT 1)
Database Management System(UNIT 1)Database Management System(UNIT 1)
Database Management System(UNIT 1)SURBHI SAROHA
 
Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1SURBHI SAROHA
 
Database Management System(UNIT 1)
Database Management System(UNIT 1)Database Management System(UNIT 1)
Database Management System(UNIT 1)SURBHI SAROHA
 
OOPS USING C++(UNIT 2)
OOPS USING C++(UNIT 2)OOPS USING C++(UNIT 2)
OOPS USING C++(UNIT 2)SURBHI SAROHA
 

Mehr von SURBHI SAROHA (20)

Cloud Computing (Infrastructure as a Service)UNIT 2
Cloud Computing (Infrastructure as a Service)UNIT 2Cloud Computing (Infrastructure as a Service)UNIT 2
Cloud Computing (Infrastructure as a Service)UNIT 2
 
Management Information System(Unit 2).pptx
Management Information System(Unit 2).pptxManagement Information System(Unit 2).pptx
Management Information System(Unit 2).pptx
 
Searching in Data Structure(Linear search and Binary search)
Searching in Data Structure(Linear search and Binary search)Searching in Data Structure(Linear search and Binary search)
Searching in Data Structure(Linear search and Binary search)
 
Management Information System(UNIT 1).pptx
Management Information System(UNIT 1).pptxManagement Information System(UNIT 1).pptx
Management Information System(UNIT 1).pptx
 
Introduction to Cloud Computing(UNIT 1).pptx
Introduction to Cloud Computing(UNIT 1).pptxIntroduction to Cloud Computing(UNIT 1).pptx
Introduction to Cloud Computing(UNIT 1).pptx
 
JAVA (UNIT 5)
JAVA (UNIT 5)JAVA (UNIT 5)
JAVA (UNIT 5)
 
DBMS (UNIT 5)
DBMS (UNIT 5)DBMS (UNIT 5)
DBMS (UNIT 5)
 
DBMS UNIT 4
DBMS UNIT 4DBMS UNIT 4
DBMS UNIT 4
 
JAVA(UNIT 4)
JAVA(UNIT 4)JAVA(UNIT 4)
JAVA(UNIT 4)
 
OOPs & C++(UNIT 5)
OOPs & C++(UNIT 5)OOPs & C++(UNIT 5)
OOPs & C++(UNIT 5)
 
OOPS & C++(UNIT 4)
OOPS & C++(UNIT 4)OOPS & C++(UNIT 4)
OOPS & C++(UNIT 4)
 
JAVA (UNIT 3)
JAVA (UNIT 3)JAVA (UNIT 3)
JAVA (UNIT 3)
 
Keys in dbms(UNIT 2)
Keys in dbms(UNIT 2)Keys in dbms(UNIT 2)
Keys in dbms(UNIT 2)
 
DBMS (UNIT 2)
DBMS (UNIT 2)DBMS (UNIT 2)
DBMS (UNIT 2)
 
JAVA UNIT 2
JAVA UNIT 2JAVA UNIT 2
JAVA UNIT 2
 
Database Management System(UNIT 1)
Database Management System(UNIT 1)Database Management System(UNIT 1)
Database Management System(UNIT 1)
 
Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1Object-Oriented Programming with Java UNIT 1
Object-Oriented Programming with Java UNIT 1
 
Database Management System(UNIT 1)
Database Management System(UNIT 1)Database Management System(UNIT 1)
Database Management System(UNIT 1)
 
OOPs & C++ UNIT 3
OOPs & C++ UNIT 3OOPs & C++ UNIT 3
OOPs & C++ UNIT 3
 
OOPS USING C++(UNIT 2)
OOPS USING C++(UNIT 2)OOPS USING C++(UNIT 2)
OOPS USING C++(UNIT 2)
 

Kürzlich hochgeladen

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
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
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
 
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
 
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
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
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
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
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
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 

Kürzlich hochgeladen (20)

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.
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
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
 
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...
 
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
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
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
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
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...
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 

Relational data model

  • 3. Relational Database  A relational database is a type of database.  It uses a structure that allows us to identify and access data in relation to another piece of data in the database.  Often, data in a relational database is organized into tables.  Tables: Rows and Columns  Tables can have hundreds, thousands, sometimes even millions of rows of data. These rows are often called records.  Tables can also have many columns of data. Columns are labeled with a descriptive name (say, age for example) and have a specific data type.  For example, a column called age may have a type of INTEGER (denoting the type of data it is meant to hold).
  • 5. Cont…  In the table above, there are three columns (name, age, and country).  The name and country columns store string data types, whereas age stores integer data types.  The set of columns and data types make up the schema of this table.  The table also has four rows, or records, in it (one each for Natalia, Ned, Zenas, and Laura).  What is a Relational Database Management System (RDBMS)?  A relational database management system (RDBMS) is a program that allows you to create, update, and administer a relational database. Most relational database management systems use the SQL language to access the database.
  • 6. Relational Algebra  Relational database systems are expected to be equipped with a query language that can assist its users to query the database instances. There are two kinds of query languages − relational algebra and relational calculus.  Relational Algebra  Relational algebra is a procedural query language, which takes instances of relations as input and yields instances of relations as output.  It uses operators to perform queries. An operator can be either unary or binary.  They accept relations as their input and yield relations as their output.  Relational algebra is performed recursively on a relation and intermediate results are also considered relations.
  • 7. Cont….  The fundamental operations of relational algebra are as follows −  Select  Project  Union  Set different  Cartesian product  Rename
  • 8. Select Operation (σ)  It selects tuples that satisfy the given predicate from a relation.  Notation − σp(r)  Where σ stands for selection predicate and r stands for relation. p is prepositional logic formula which may use connectors like and, or, and not. These terms may use relational operators like − =, ≠, ≥, < , >, ≤.  For example −  σsubject = "database"(Books)  Output − Selects tuples from books where subject is 'database'.  σsubject = "database" and price = "450"(Books)  Output − Selects tuples from books where subject is 'database' and 'price' is 450.  σsubject = "database" and price = "450" or year > "2010"(Books)  Output − Selects tuples from books where subject is 'database' and 'price' is 450 or those books published after 2010.
  • 9. Project Operation (∏)  It projects column(s) that satisfy a given predicate.  Notation − ∏A1, A2, An (r)  Where A1, A2 , An are attribute names of relation r.  Duplicate rows are automatically eliminated, as relation is a set.  For example −  ∏subject, author (Books)  Selects and projects columns named as subject and author from the relation Books.  Union Operation (∪)  It performs binary union between two given relations and is defined as −
  • 10. Cont….  r ∪ s = { t | t ∈ r or t ∈ s}  Notation − r U s  Where r and s are either database relations or relation result set (temporary relation).  For a union operation to be valid, the following conditions must hold −  r, and s must have the same number of attributes.  Attribute domains must be compatible.  Duplicate tuples are automatically eliminated.  ∏ author (Books) ∪ ∏ author (Articles)  Output − Projects the names of the authors who have either written a book or an article or both.
  • 11. Set Difference (−)  The result of set difference operation is tuples, which are present in one relation but are not in the second relation.  Notation − r − s  Finds all the tuples that are present in r but not in s.  ∏ author (Books) − ∏ author (Articles)  Output − Provides the name of authors who have written books but not articles.  Cartesian Product (Χ)  Combines information of two different relations into one.
  • 12. Cont….  Notation − r Χ s  Where r and s are relations and their output will be defined as −  r Χ s = { q t | q ∈ r and t ∈ s}  σauthor = 'tutorialspoint'(Books Χ Articles)  Output − Yields a relation, which shows all the books and articles written by tutorialspoint.
  • 13. Rename Operation (ρ)  The results of relational algebra are also relations but without any name. The rename operation allows us to rename the output relation. 'rename' operation is denoted with small Greek letter rho ρ.  Notation − ρ x (E)  Where the result of expression E is saved with name of x.  Additional operations are −  Set intersection  Assignment  Natural join
  • 14. Structured Query Language(SQL)  SQL is a standard language for accessing and manipulating databases.  What is SQL?  SQL stands for Structured Query Language  SQL lets you access and manipulate databases  SQL became a standard of the American National Standards Institute (ANSI) in 1986, and of the International Organization for Standardization (ISO) in 1987.  Although SQL is an ANSI/ISO standard, there are different versions of the SQL language.  However, to be compliant with the ANSI standard, they all support at least the major commands (such as SELECT, UPDATE, DELETE, INSERT, WHERE) in a similar manner.
  • 15. What Can SQL do?  SQL can execute queries against a database  SQL can retrieve data from a database  SQL can insert records in a database  SQL can update records in a database  SQL can delete records from a database  SQL can create new databases  SQL can create new tables in a database  SQL can create stored procedures in a database  SQL can create views in a database  SQL can set permissions on tables, procedures, and views
  • 16. Using SQL in Your Web Site  To build a web site that shows data from a database, you will need:  An RDBMS database program (i.e. MS Access, SQL Server, MySQL)  To use a server-side scripting language, like PHP or ASP  To use SQL to get the data you want  To use HTML / CSS to style the page
  • 17. RDBMS  RDBMS stands for Relational Database Management System.  RDBMS is the basis for SQL, and for all modern database systems such as MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.  The data in RDBMS is stored in database objects called tables. A table is a collection of related data entries and it consists of columns and rows.  Look at the "Customers" table:  Example  SELECT * FROM Customers;
  • 18. Some of The Most Important 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
  • 19. The SQL SELECT Statement  The SELECT statement is used to select data from a database.  The data returned is stored in a result table, called the result-set.  SELECT Syntax  SELECT column1, column2, ...  FROM table_name;  Here, column1, column2, ... are the field names of the table you want to select data from. If you want to select all the fields available in the table, use the following syntax:  SELECT * FROM table_name;