SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

La actualidad más candente

Introduction of DBMS
Introduction of DBMSIntroduction of DBMS
Introduction of DBMSYouQue ™
 
TID Chapter 10 Introduction To Database
TID Chapter 10 Introduction To DatabaseTID Chapter 10 Introduction To Database
TID Chapter 10 Introduction To DatabaseWanBK Leo
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMSkoolkampus
 
Advanced Database Lecture Notes
Advanced Database Lecture NotesAdvanced Database Lecture Notes
Advanced Database Lecture NotesJasour Obeidat
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model IntroductionNishant Munjal
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database DesignPrabu U
 
File organization and introduction of DBMS
File organization and introduction of DBMSFile organization and introduction of DBMS
File organization and introduction of DBMSVrushaliSolanke
 
Introduction of sql server indexing
Introduction of sql server indexingIntroduction of sql server indexing
Introduction of sql server indexingMahabubur Rahaman
 
Database Design Slide 1
Database Design Slide 1Database Design Slide 1
Database Design Slide 1ahfiki
 
Introduction to NoSQL Databases
Introduction to NoSQL DatabasesIntroduction to NoSQL Databases
Introduction to NoSQL DatabasesDerek Stainer
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introductionPooyan Mehrparvar
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraintsmadhav bansal
 
Fundamentals of Database ppt ch01
Fundamentals of Database ppt ch01Fundamentals of Database ppt ch01
Fundamentals of Database ppt ch01Jotham Gadot
 
9. Object Relational Databases in DBMS
9. Object Relational Databases in DBMS9. Object Relational Databases in DBMS
9. Object Relational Databases in DBMSkoolkampus
 
Database Programming
Database ProgrammingDatabase Programming
Database ProgrammingHenry Osborne
 

La actualidad más candente (20)

Introduction of DBMS
Introduction of DBMSIntroduction of DBMS
Introduction of DBMS
 
TID Chapter 10 Introduction To Database
TID Chapter 10 Introduction To DatabaseTID Chapter 10 Introduction To Database
TID Chapter 10 Introduction To Database
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
 
NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
Advanced Database Lecture Notes
Advanced Database Lecture NotesAdvanced Database Lecture Notes
Advanced Database Lecture Notes
 
Data warehouse
Data warehouseData warehouse
Data warehouse
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 
File organization and introduction of DBMS
File organization and introduction of DBMSFile organization and introduction of DBMS
File organization and introduction of DBMS
 
Introduction of sql server indexing
Introduction of sql server indexingIntroduction of sql server indexing
Introduction of sql server indexing
 
Database Design Slide 1
Database Design Slide 1Database Design Slide 1
Database Design Slide 1
 
Basic DBMS ppt
Basic DBMS pptBasic DBMS ppt
Basic DBMS ppt
 
Introduction to NoSQL Databases
Introduction to NoSQL DatabasesIntroduction to NoSQL Databases
Introduction to NoSQL Databases
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introduction
 
Distributed DBMS - Unit 3 - Distributed DBMS Architecture
Distributed DBMS - Unit 3 - Distributed DBMS ArchitectureDistributed DBMS - Unit 3 - Distributed DBMS Architecture
Distributed DBMS - Unit 3 - Distributed DBMS Architecture
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
Fundamentals of Database ppt ch01
Fundamentals of Database ppt ch01Fundamentals of Database ppt ch01
Fundamentals of Database ppt ch01
 
Triggers and active database
Triggers and active databaseTriggers and active database
Triggers and active database
 
9. Object Relational Databases in DBMS
9. Object Relational Databases in DBMS9. Object Relational Databases in DBMS
9. Object Relational Databases in DBMS
 
Database Programming
Database ProgrammingDatabase Programming
Database Programming
 

Similar a Relational data model (20)

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
 
ch3.ppt
ch3.pptch3.ppt
ch3.ppt
 

Más de 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
 

Más de 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)
 

Último

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 

Último (20)

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 

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;