The document discusses relational algebra, which defines a set of operations for the relational model. The relational algebra operations can be divided into two groups: set operations from mathematical set theory including UNION, INTERSECTION, and SET DIFFERENCE; and operations developed specifically for relational databases including SELECT, PROJECT, and JOIN. The six basic relational algebra operators are SELECT, PROJECT, UNION, INTERSECTION, SET DIFFERENCE, and CARTESIAN PRODUCT. RELATIONAL expressions allow sequences of these operations to be combined to retrieve and manipulate data from relations.
In DBMS (DataBase Management System), the relation algebra is important term to further understand the queries in SQL (Structured Query Language) database system. In it just give up the overview of operators in DBMS two of one method relational algebra used and another name is relational calculus.
You can get clear knowledge about the functional dependencies in "Normalization". And also the rules, types of FDs and finally the closure and its applications
In DBMS (DataBase Management System), the relation algebra is important term to further understand the queries in SQL (Structured Query Language) database system. In it just give up the overview of operators in DBMS two of one method relational algebra used and another name is relational calculus.
You can get clear knowledge about the functional dependencies in "Normalization". And also the rules, types of FDs and finally the closure and its applications
The solution to the single-source shortest-path tree problem in graph theory. This slide was prepared for Design and Analysis of Algorithm Lab for B.Tech CSE 2nd Year 4th Semester.
The solution to the single-source shortest-path tree problem in graph theory. This slide was prepared for Design and Analysis of Algorithm Lab for B.Tech CSE 2nd Year 4th Semester.
ACID properties
Atomicity, Consistency, Isolation, Durability
Transactions should possess several properties, often called the ACID properties; they should be enforced by the concurrency control and recovery methods of the DBMS.
Data security is of utmost importance, yet people mostly disregard security in database management systems (DBMS). This talk aims to shed some light on security features in some DBMS and the importance of using them. There is talk of authentication, authorization, encryption, auditing and network technologies of the following DBMS: Oracle, PostgreSQL, IBM DB2, SAP HANA, SQL Server, MySQL, Drizzle, HyperSQL, Advantage Database Server, ScimoreDB, Raima Database Manager. There is also a bit about NoSQL DBMS: Apache's HBase and CouchDB, MongoDB and Redis.
What is Relational model
Characteristics
Relational constraints
Representation of schemas
characteristics and Constraints of Relational model with proper examples.
Updates and dealing with constraint violations in Relational model
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?XfilesPro
Worried about document security while sharing them in Salesforce? Fret no more! Here are the top-notch security standards XfilesPro upholds to ensure strong security for your Salesforce documents while sharing with internal or external people.
To learn more, read the blog: https://www.xfilespro.com/how-does-xfilespro-make-document-sharing-secure-and-seamless-in-salesforce/
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
We describe the deployment and use of Globus Compute for remote computation. This content is aimed at researchers who wish to compute on remote resources using a unified programming interface, as well as system administrators who will deploy and operate Globus Compute services on their research computing infrastructure.
Why React Native as a Strategic Advantage for Startup Innovation.pdfayushiqss
Do you know that React Native is being increasingly adopted by startups as well as big companies in the mobile app development industry? Big names like Facebook, Instagram, and Pinterest have already integrated this robust open-source framework.
In fact, according to a report by Statista, the number of React Native developers has been steadily increasing over the years, reaching an estimated 1.9 million by the end of 2024. This means that the demand for this framework in the job market has been growing making it a valuable skill.
But what makes React Native so popular for mobile application development? It offers excellent cross-platform capabilities among other benefits. This way, with React Native, developers can write code once and run it on both iOS and Android devices thus saving time and resources leading to shorter development cycles hence faster time-to-market for your app.
Let’s take the example of a startup, which wanted to release their app on both iOS and Android at once. Through the use of React Native they managed to create an app and bring it into the market within a very short period. This helped them gain an advantage over their competitors because they had access to a large user base who were able to generate revenue quickly for them.
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
Tim Combridge from Sensible Giraffe and Salesforce Ben presents some important tips that all developers should know when dealing with Flows in Salesforce.
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
Unlocking Business Potential: Tailored Technology Solutions by Prosigns
Discover how Prosigns, a leading technology solutions provider, partners with businesses to drive innovation and success. Our presentation showcases our comprehensive range of services, including custom software development, web and mobile app development, AI & ML solutions, blockchain integration, DevOps services, and Microsoft Dynamics 365 support.
Custom Software Development: Prosigns specializes in creating bespoke software solutions that cater to your unique business needs. Our team of experts works closely with you to understand your requirements and deliver tailor-made software that enhances efficiency and drives growth.
Web and Mobile App Development: From responsive websites to intuitive mobile applications, Prosigns develops cutting-edge solutions that engage users and deliver seamless experiences across devices.
AI & ML Solutions: Harnessing the power of Artificial Intelligence and Machine Learning, Prosigns provides smart solutions that automate processes, provide valuable insights, and drive informed decision-making.
Blockchain Integration: Prosigns offers comprehensive blockchain solutions, including development, integration, and consulting services, enabling businesses to leverage blockchain technology for enhanced security, transparency, and efficiency.
DevOps Services: Prosigns' DevOps services streamline development and operations processes, ensuring faster and more reliable software delivery through automation and continuous integration.
Microsoft Dynamics 365 Support: Prosigns provides comprehensive support and maintenance services for Microsoft Dynamics 365, ensuring your system is always up-to-date, secure, and running smoothly.
Learn how our collaborative approach and dedication to excellence help businesses achieve their goals and stay ahead in today's digital landscape. From concept to deployment, Prosigns is your trusted partner for transforming ideas into reality and unlocking the full potential of your business.
Join us on a journey of innovation and growth. Let's partner for success with Prosigns.
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
Understanding Globus Data Transfers with NetSageGlobus
NetSage is an open privacy-aware network measurement, analysis, and visualization service designed to help end-users visualize and reason about large data transfers. NetSage traditionally has used a combination of passive measurements, including SNMP and flow data, as well as active measurements, mainly perfSONAR, to provide longitudinal network performance data visualization. It has been deployed by dozens of networks world wide, and is supported domestically by the Engagement and Performance Operations Center (EPOC), NSF #2328479. We have recently expanded the NetSage data sources to include logs for Globus data transfers, following the same privacy-preserving approach as for Flow data. Using the logs for the Texas Advanced Computing Center (TACC) as an example, this talk will walk through several different example use cases that NetSage can answer, including: Who is using Globus to share data with my institution, and what kind of performance are they able to achieve? How many transfers has Globus supported for us? Which sites are we sharing the most data with, and how is that changing over time? How is my site using Globus to move data internally, and what kind of performance do we see for those transfers? What percentage of data transfers at my institution used Globus, and how did the overall data transfer performance compare to the Globus users?
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
Even though at surface level ‘java.lang.OutOfMemoryError’ appears as one single error; underlyingly there are 9 types of OutOfMemoryError. Each type of OutOfMemoryError has different causes, diagnosis approaches and solutions. This session equips you with the knowledge, tools, and techniques needed to troubleshoot and conquer OutOfMemoryError in all its forms, ensuring smoother, more efficient Java applications.
In software engineering, the right architecture is essential for robust, scalable platforms. Wix has undergone a pivotal shift from event sourcing to a CRUD-based model for its microservices. This talk will chart the course of this pivotal journey.
Event sourcing, which records state changes as immutable events, provided robust auditing and "time travel" debugging for Wix Stores' microservices. Despite its benefits, the complexity it introduced in state management slowed development. Wix responded by adopting a simpler, unified CRUD model. This talk will explore the challenges of event sourcing and the advantages of Wix's new "CRUD on steroids" approach, which streamlines API integration and domain event management while preserving data integrity and system resilience.
Participants will gain valuable insights into Wix's strategies for ensuring atomicity in database updates and event production, as well as caching, materialization, and performance optimization techniques within a distributed system.
Join us to discover how Wix has mastered the art of balancing simplicity and extensibility, and learn how the re-adoption of the modest CRUD has turbocharged their development velocity, resilience, and scalability in a high-growth environment.
Enhancing Research Orchestration Capabilities at ORNL.pdfGlobus
Cross-facility research orchestration comes with ever-changing constraints regarding the availability and suitability of various compute and data resources. In short, a flexible data and processing fabric is needed to enable the dynamic redirection of data and compute tasks throughout the lifecycle of an experiment. In this talk, we illustrate how we easily leveraged Globus services to instrument the ACE research testbed at the Oak Ridge Leadership Computing Facility with flexible data and task orchestration capabilities.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
Data privacy is one of the most critical issues that businesses face. This presentation shares insights on the principles and best practices for ensuring the resilience and security of your workload.
Drawing on a real-life project from the HR industry, the various challenges will be demonstrated: data protection, self-healing, business continuity, security, and transparency of data processing. This systematized approach allowed to create a secure AWS cloud infrastructure that not only met strict compliance rules but also exceeded the client's expectations.
1. Aruna Devi.C (DSCASC) 1
Data Base Management System
[DBMS]
Chapter 5
Unit III
Relational Algebra
2. Relational Algebra
Historically, the relational algebra and calculus were developed before the SQL
language.
In fact, in some ways, SQL is based on concepts from both the algebra and the
calculus.
The algebra defines a set of operations for the relational model.
A relational calculus expression creates a new relation.
Aruna Devi.C (DSCASC)
3. The relational algebra is often considered to be an integral part of the relational
data model.
Its operations can be divided into two groups:
First group - set operations from mathematical set theory; these are applicable
because each relation is defined to be a set of tuples in the formal relational
model.
Set operations include UNION, INTERSECTION, SET DIFFERENCE, and
CARTESIAN PRODUCT (also known as CROSS PRODUCT).
Second group - consists of operations developed specifically for relational
databases—these include SELECT, PROJECT, and JOIN, among others.
Relational Algebra (cont.,)
Aruna Devi.C (DSCASC)
4. Relational Algebra
Six basic operators:
Select: σ - Selects tuples that satisfy a given predicate
Project: ∏ - Projects specified fields.
Union: ∪
Intersection: ∩
Set difference: –
Cartesian product: x
Rename: ρ
Division: ÷
Joints
The operators take one or two relations as inputs and produce a
new relation as a result.
4Aruna Devi.C (DSCASC)
5. Unary Relational Operations
SELECT and PROJECT
The SELECT Operation:
The SELECT operation is used to choose a subset of the tuples from a relation that
satisfies a selection condition.
The SELECT operation is denoted by
σ <selection condition> (R)
where the symbol σ (sigma) is used to denote the SELECT operator.
The selection condition is a Boolean expression (condition) specified on the
attributes of relation R.
σ Dno=4(EMPLOYEE)
σ Salary>30000(EMPLOYEE)
Where Dno is Department
No.
<comparison op> is normally one of the operators {=, <, ≤, >, ≥, ≠}.
Clauses can be connected by the standard Boolean operators and, or, and not to
form a general selection condition.
6. Select Operation
Notation: σ p(r)
p is called the selection predicate
Defined as:
σP(r) = {t | t ∈ r and p(t)}
Where p is a formula connected by : ∧ (and), ∨ (or), ¬ (not)
Example of selection:
σ branch_name=“Perryridge”(account)
6Aruna Devi.C (DSCASC)
7. Select Operation – Example
7
Relation r
A B C D
α
α
β
β
α
β
β
β
1
5
12
23
7
7
3
10
σA=B ^ D > 5 (r)
A B C D
α
β
α
β
1
23
7
10
Aruna Devi.C (DSCASC)
8. The PROJECT Operation:
The PROJECT operation, selects certain columns from the table and discards the
other columns.
The SELECT operation chooses some of the rows from the table while discarding
other rows.
The general form of the PROJECT operation is
π <attribute list> (R)
where π (pi) is the symbol used to represent the PROJECT operation, and <attribute
list> is the desired sublist of attributes from the attributes of relation R.
For example, to list each employee’s first and last name and salary, we can use the
PROJECT operation as follows:
π Lname, Fname, Salary(EMPLOYEE)
Unary Relational Operations
SELECT and PROJECT
9. Project Operation
Notation:
where A1, A2 are attribute names and r is a relation name.
The result is defined as the relation of k columns obtained by erasing the
columns that are not listed.
Duplicate rows removed from result, since relations are sets
Eg: To eliminate the branch_name attribute of account
∏account_number,balance (account)
9
)(,,, 21
rkAAA
∏
Aruna Devi.C (DSCASC)
10. Project Operation – Example
Relation r:
10
A B C
α
α
β
β
10
20
30
40
1
1
1
2
A C
α
α
β
β
1
1
1
2
=
A C
α
β
β
1
1
2
∏A,C (r)
Aruna Devi.C (DSCASC)
12. SELECT and PROJECT
In SQL, the SELECT condition is typically specified in the WHERE clause of a
query.
For example, the following operation:
σDno=4 AND Salary>25000 (EMPLOYEE)
would correspond to the following SQL query:
SELECT * FROM EMPLOYEE WHERE Dno=4 AND Salary>25000;
Aruna Devi.C (DSCASC)
Company Database
13. Sequences of Operations
To retrieve the first name, last name, and salary of all employees who work in
department number 5, we must apply a SELECT and a PROJECT operation.
We can write a single relational algebra expression, also known as an in-line
expression, as follows:
π Fname, Lname, Salary(σDno=5(EMPLOYEE))
Next page shows the result of this in-line relational algebra expression.
Aruna Devi.C (DSCASC)
14. Sequences of Operations
π Fname, Lname, Salary(σDno=5(EMPLOYEE))
Aruna Devi.C (DSCASC)
Company Database
15. Sequences of Operations
To rename the attributes in a relation, we simply list the new attribute names in
parentheses, as in the following example:
TEMP σDno=5(EMPLOYEE)←
R(First_name, Last_name, Salary) πFname, Lname, Salary(TEMP)←
If no renaming is applied, the names of the attributes in the resulting relation of a
SELECT operation are the same as those in the original relation and in the same
order.
For a PROJECT operation with no renaming, the resulting relation has the same
attribute names as those in the projection list and in the same order in which they
appear in the list.
Aruna Devi.C (DSCASC)
16. Sequences of Operations
TEMP ← σDno=5(EMPLOYEE)
R(First_name, Last_name, Salary) ← πFname, Lname, Salary(TEMP)
Aruna Devi.C (DSCASC)
Company Database
17. Rename Operation
Allows us to name, and therefore to refer to, the results of relational-algebra
expressions.
Allows us to refer to a relation by more than one name.
Example:
ρ x (E)
returns the expression E under the name X
If a relational-algebra expression E has arity n, then returns the result of
expression E under the name X, and with the attributes renamed to A1, A2, ….,
An.
17
)(),...,,( 21
EnAAAx
ρ
Aruna Devi.C (DSCASC)
18. Rename Operation
In SQL, a single query typically represents a complex relational algebra
expression.
Renaming in SQL is accomplished by aliasing using AS, as in the following
example:
SELECT E.Fname AS First_name, E.Lname AS Last_name, E.Salary AS Salary
FROM EMPLOYEE AS E
WHERE E.Dno=5,
Aruna Devi.C (DSCASC)
Company Database
19. Union Operation – Example
Relations r, s:
19
r ∪ s:
A B
α
α
β
1
2
1
A B
α
β
2
3
r
s
A B
α
α
β
β
1
2
1
3
Aruna Devi.C (DSCASC)
20. Relational Algebra Operations from Set Theory
The UNION, INTERSECTION, and MINUS Operations:
We can define the three operations UNION, INTERSECTION, and SET DIFFERENCE
on two union-compatible relations R and S as follows:
■ UNION: The result of this operation, denoted by R U S, is a relation that
includes all tuples that are either in R or in S or in both R and S. Duplicate
tuples are eliminated.
■ INTERSECTION: The result of this operation, denoted by R ∩ S, is a relation that
includes all tuples that are in both R and S.
■ SET DIFFERENCE (or MINUS): The result of this operation, denoted by
R – S, is a relation that includes all tuples that are in R but not in S.
Aruna Devi.C (DSCASC)
21. Union Operation
Notation: r ∪ s
Defined as:
r ∪ s = {t | t ∈ r or t ∈ s}
For r ∪ s to be valid.
1. r, s must have the same arity (same number of attributes)
2. The attribute domains must be compatible (example: 2nd
column
of r deals with the same type of values as does the 2nd
column of s)
Example: to find all customers with either an account or a loan
∏customer_name (depositor) ∪ ∏customer_name (borrower)
21Aruna Devi.C (DSCASC)
22. Set Difference Operation
Relations r, s:
22
r – s:
A B
α
α
β
1
2
1
A B
α
β
2
3
r
s
A B
α
β
1
1
Aruna Devi.C (DSCASC)
23. Set Difference Operation
Notation r – s
Defined as:
r – s = {t | t ∈ r and t ∉ s}
Set differences must be taken between compatible
relations.
r and s must have the same arity
attribute domains of r and s must be compatible
23Aruna Devi.C (DSCASC)
24. Set-Intersection Operation
Notation: r ∩ s
Defined as:
r ∩ s = { t | t ∈ r and t ∈ s }
Assume:
r, s have the same arity
attributes of r and s are compatible
Note: r ∩ s = r – (r – s)
24Aruna Devi.C (DSCASC)
26. The CARTESIAN PRODUCT (CROSS PRODUCT) Operation
This set operation produces a new element by combining every member
(tuple) from one relation (set) with every member (tuple) from the other
relation (set). In general, the result of
R(A1, A2, ..., An) X S(B1, B2, ..., Bm) is a relation Q
Aruna Devi.C (DSCASC)
27. Cartesian-Product Operation
27
Relations r, s:
r x s:
A B
α
β
1
2
A B
α
α
α
α
β
β
β
β
1
1
1
1
2
2
2
2
C D
α
β
β
γ
α
β
β
γ
10
10
20
10
10
10
20
10
E
a
a
b
b
a
a
b
b
C D
α
β
β
γ
10
10
20
10
E
a
a
b
br
s
Aruna Devi.C (DSCASC)
28. Composition of Operations
Can build expressions using multiple operations
Example: σA=C(r x s)
r x s
σA=C(r x s)
28
A B
α
α
α
α
β
β
β
β
1
1
1
1
2
2
2
2
C D
α
β
β
γ
α
β
β
γ
10
10
20
10
10
10
20
10
E
a
a
b
b
a
a
b
b
A B C D E
α
β
β
1
2
2
α
β
β
10
10
20
a
a
b
Aruna Devi.C (DSCASC)
29. Binary Relational Operations:
JOIN and DIVISION
The JOIN Operation:
The JOIN operation, denoted by , is used to combine related tuples from two
relations into single “longer” tuples.
The join operator allows the combination of two relations to form a single new
relation.
The JOIN operation can be specified as a CARTESIAN PRODUCT operation
followed by a SELECT operation.
Aruna Devi.C (DSCASC)
30. Natural-Join Operation
Example:
R = (A, B, C, D)
S = (E, B, D)
Result schema = (A, B, C, D, E)
r s is defined as:
∏r.A,r.B,r.C,r.D,s.E (σr.B=s.B∧r.D=s.D (r x s))
30
Notation: r s
Aruna Devi.C (DSCASC)
31. Natural Join Operation
Relations r, s:
31
A B
α
β
γ
α
δ
1
2
4
1
2
C D
α
γ
β
γ
β
a
a
b
a
b
B
1
3
1
2
3
D
a
a
a
b
b
E
α
β
γ
δ
∈
r
A B
α
α
α
α
δ
1
1
1
1
2
C D
α
α
γ
γ
β
a
a
a
a
b
E
α
γ
α
γ
δ
s
r s
Aruna Devi.C (DSCASC)
32. Variations of JOIN: The EQUIJOIN and NATURAL JOIN
The only comparison operator used is =, is called an EQUIJOIN.
NATURAL JOIN requires that the two join attributes (or each pair of join attributes)
have the same name in both relations.
The equality join condition specified on these two attributes requires the values to be
identical in every tuple in the result.
NATURAL JOIN — denoted by *— was created to get rid of the second (superfluous)
attribute in an EQUIJOIN condition.
Aruna Devi.C (DSCASC)
35. NATURAL JOIN
Result of two Natural Join: a) PROJ_DEPT PROJECT * DEPT
b) DEPT_LOCS DEPARTMENT * DEPT _LOCATIONS
36. A Complete Set of Relational Algebra Operations
Relational algebra operations {σ, π, U, ρ, –, x} is a complete set.
For example, the INTERSECTION operation can be expressed by using UNION
and MINUS.
A JOIN operation can be specified as a CARTESIAN PRODUCT followed by a
SELECT operation.
A NATURAL JOIN can be specified as a CARTESIAN PRODUCT preceded by
RENAME and followed by SELECT and PROJECT operations.
Aruna Devi.C (DSCASC)
37. A Complete Set of Relational Algebra Operations (Cont.,)
An example is Retrieve the names of employees who work on all the projects
that ‘John Smith’ works on.
First, retrieve the list of project numbers that ‘John Smith’ works on in the
intermediate relation SMITH_PNOS:
Aruna Devi.C (DSCASC)
38. Division Operation
The DIVISION operation, denoted by ÷, is useful for a special kind of query that
sometimes occurs in database applications.
An example is Retrieve the names of employees who work on all the projects that
‘John Smith’ works on.
1) First, retrieve the list of project numbers that ‘John Smith’ works on in the
intermediate relation SMITH_PNOS:
SMITH ← σFname=‘John’ AND Lname=‘Smith’ (EMPLOYEE)
SMITH_PNOS ← πPno (WORKS_ON Essn=Ssn SMITH)
2) Next, create a relation that includes a tuple <Pno, Essn> whenever the employee
whose Ssn is Essn works on the project whose number is Pno in the intermediate
relation SSN_PNOS:
SSN_PNOS ← πEssn, Pno (WORKS_ON)
38Aruna Devi.C (DSCASC)
Company Database
39. Division Operation
3) Finally, apply the DIVISION operation to the two relations, which gives the desired
employees’ Social Security numbers:
SSNS(Ssn) SSN_PNOS← ÷ SMITH_PNOS
RESULT πFname, Lname (SSNS← * EMPLOYEE)
Company Database
40. Division Operation
In general, the DIVISION operation is applied to two
relations R(Z) ÷ S(X), where the attributes of R are a subset of
the attributes of S.
Example:
1) The table SSN_PNOS is from works on table.
2)The table Smith-Pnos is from which project smith work-on, that is from employee table and
works-on table.
3) SSNS is the final table where check which all projects smith the same projects all the other
employees should work on so only two employees work for both the projects.
Aruna Devi.C (DSCASC)
42. Additional Relational Operations
1. Generalized Projection:
The generalized projection operation extends the projection operation by allowing
functions of attributes to be included in the projection list.
The generalized form can be expressed as:
πF1, F2, ..., Fn (R)
where F1, F2, ..., Fn are functions over the attributes in relation R and may involve
arithmetic operations and constant values.
This operation is helpful when developing reports where computed values have to be
produced in the columns of a query result.
Aruna Devi.C (DSCASC)
43. Additional Relational Operations (Cont.,)
As an example, consider the relation
EMPLOYEE (Ssn, Salary, Deduction, Years_service)
A report may be required to show
Net Salary = Salary – Deduction,
Bonus = 2000 * Years_service, and
Tax = 0.25 * Salary.
Then a generalized projection combined with renaming may be used as follows:
REPORT ρ(Ssn, Net_salary, Bonus, Tax)(πSsn, Salary – Deduction, 2000 * Years_service, 0.25 * Salary(EMPLOYEE))←
Aruna Devi.C (DSCASC)
44. 2. Aggregate Functions and Grouping:
Another type of request that cannot be expressed in the basic relational algebra is to
specify mathematical aggregate functions on collections of values from the database.
Examples: Retrieving the average or total salary of all employees or the total number of
employee tuples.
Common functions applied to collections of numeric values include SUM, AVERAGE,
MAXIMUM, MINIMUM and COUNT.
Another common type of request involves grouping the tuples in a relation.
Example: Group EMPLOYEE tuples by Dno.
Additional Relational Operations (Cont.,)
Aruna Devi.C (DSCASC)
45. Additional Relational Operations (Cont.,)
We can define an AGGREGATE FUNCTION operation, using the symbol .ℑ
<grouping attributes> <function list> (ℑ R)
Example:
Aruna Devi.C (DSCASC)
46. Additional Relational Operations (Cont.,)
3. Recursive Closure Operations:
This operation is applied to a recursive relationship
between tuples of the same type, such as the relationship
between an employee and a supervisor.
Aruna Devi.C (DSCASC)
47. Additional Relational Operations (Cont.,)
4. OUTER JOIN Operations:
The JOIN operations described earlier match tuples that satisfy the join
condition.
For example, for a NATURAL JOIN operation R * S, only tuples from R that have
matching tuples in S—and vice versa—appear in the result.
Hence, tuples without a matching (or related) tuple are eliminated from the
JOIN result.
Tuples with NULL values in the join attributes are also eliminated.
This type of join, where tuples with no match are eliminated, is known as an
inner join.
There is an amount of loss in information.
Aruna Devi.C (DSCASC)
48. Additional Relational Operations (Cont.,)
Different JOINs:
Join: Return rows when there is at least one match in both tables.
Left Outer Join: Return all rows from the first or left table, even if there are no
matches in the right table. R S
Right Outer Join: Return all rows from the second or right table, even if there
are no matches in the left table. R S
Full Outer Join: Return rows when there is a match in one of the tables.
R S
Aruna Devi.C (DSCASC)
50. Examples of Queries in Relational Algebra (Cont.,)
Query 1. Retrieve the name and address of all employees who work for the ‘Research’
department.
Query 2. For every project located in ‘Stafford’, list the project number, the controlling
department number, and the department manager’s last name, address, and birth date.
we first select the projects located in Stafford, then join them with their controlling departments, and then
join the result with the department managers. Finally, we apply a project operation on the desired
attributes.
51. Query 3. Find the names of employees who work on all the projects controlled by
department number 5.
In this query, we first create a table DEPT5_PROJS that contains the project
numbers of all projects controlled by department 5.
Then we create a table EMP_PROJ that holds (Ssn, Pno) tuples, and apply the
division operation.
Notice that we renamed the attributes so that they will be correctly used in the
division operation.
Finally,we join the result of the division, which holds only Ssn values, with the
EMPLOYEE table to retrieve the desired attributes from EMPLOYEE.
Examples of Queries in Relational Algebra (Cont.,)
Aruna Devi.C (DSCASC)
52. Query 4. Make a list of project numbers for projects that involve an employee
whose last name is ‘Smith’, either as a worker or as a manager of the department
that controls the project.
In this query, we retrieved the project numbers for projects that involve an
employee named Smith as a worker in SMITH_WORKER_PROJS. Then we
retrieved the project numbers for projects that involve an employee named Smith
as manager of the department that controls the project in SMITH_MGR_PROJS.
Finally, we applied the UNION operation on SMITH_WORKER_PROJS and
SMITH_MGR_PROJS.
Examples of Queries in Relational Algebra (Cont.,)
Aruna Devi.C (DSCASC)
53. Other Example Queries
Find all loans of over $1200
53
Find the loan number for each loan of an amount greater
than $1200
σamount > 1200 (loan)
∏loan_number (σamount > 1200 (loan))
Find the names of all customers who have a loan, an
account, or both, from the bank
Find the names of all customers who have a loan
and an account at bank.
∏customer_name (borrower) ∪ ∏customer_name (depositor)
∏customer_name (borrower) ∩ ∏customer_name
(depositor)
54. Example Queries
1) Find the names of all customers who have a loan at the Perryridge
branch.
54
2) Find the names of all customers who have a loan at the Perryridge
branch but do not have an account at any branch of the bank.
∏customer_name (σbranch_name = “Perryridge”
(σborrower.loan_number = loan.loan_number(borrower x loan))) –
∏customer_name(depositor)
∏customer_name (σbranch_name=“Perryridge”
(σborrower.loan_number = loan.loan_number(borrower x loan)))
Aruna Devi.C (DSCASC)
55. Example Queries
Find the names of all customers who have a loan at the Perryridge
branch.
55
Query 2
∏customer_name(σloan.loan_number = borrower.loan_number (
(σbranch_name = “Perryridge” (loan)) x borrower))
Query 1
∏customer_name (σbranch_name = “Perryridge” (
σborrower.loan_number = loan.loan_number (borrower x loan)))
Aruna Devi.C (DSCASC)
57. Step 1: Mapping of Regular Entity Types.
Step 2: Mapping of Weak Entity Types.
Step 3: Mapping of Binary 1:1 Relationship Types.
Step 4: Mapping of Binary 1:N Relationship Types.
Step 5: Mapping of Binary M:N Relationship Types.
Step 6: Mapping of Multi valued Attributes.
Step 7: Mapping of N-ary Relationship Types.
Relational Database Design Using ER-to-Relational Mapping (Cont.,)
58. Relational Database Design Using ER-to-Relational Mapping (Cont.,)
Step 1: Mapping of Regular Entity Types:
For each regular (strong) entity type E in the ER schema, create a relation R that
includes all the simple attributes of E.
Include only the simple component attributes of a composite attribute.
Choose one of the key attributes of E as the primary key for R.
If the chosen key of E is a composite, then the set of simple attributes that form it
will together form the primary key of R.
If multiple keys were identified for E during the conceptual design, the information
describing the attributes that form each additional key is kept in order to specify
secondary (unique) keys of relation R.
We create the relations EMPLOYEE, DEPARTMENT, and PROJECT in Figure 2 to
correspond to the regular entity types EMPLOYEE, DEPARTMENT, and PROJECT in
Figure 1.
59. Relational Database Design Using ER-to-Relational Mapping (Cont.,)
The foreign key and relationship attributes, if any, are not included yet; they will
be added during subsequent steps.
Example, we choose Ssn, Dnumber, and Pnumber as primary keys for the
relations EMPLOYEE, DEPARTMENT, and PROJECT, respectively.
The relations that are created from the mapping of entity types are sometimes
called entity relations because each tuple represents an entity instance.
62. Relational Database Design Using ER-to-Relational Mapping (Cont.,)
Step 2: Mapping of Weak Entity Types:
For each weak entity type W in the ER schema with owner entity type E, create a
relation R and include all simple attributes (or simple components of composite
attributes) of W as attributes of R.
In addition, include as foreign key attributes of R, the primary key attribute(s) of
the relation(s) that correspond to the owner entity type(s); this takes care of
mapping the identifying relationship type of W.
The primary key of R is the combination of the primary key(s) of the owner(s) and
the partial key of the weak entity type W, if any.
Aruna Devi.C (DSCASC)
63. Relational Database Design Using ER-to-Relational Mapping (Cont.,)
We create the relation DEPENDENT in this step to correspond to the weak entity
type DEPENDENT.
The primary key of the DEPENDENT relation is the combination {Essn,
Dependent_name}, because Dependent_name is the partial key of DEPENDENT.
Aruna Devi.C (DSCASC)
64. Relational Database Design Using ER-to-Relational Mapping (Cont.,)
Step 3: Mapping of Binary 1:1 Relationship Types:
For each binary 1:1 relationship type R in the ER schema, identify the relations S
and T that correspond to the entity types participating in R.
There are three possible approaches:
(a) the foreign key approach,
(b) the merged relationship approach, and
(c) the cross reference or relationship relation approach.
a. Foreign key approach:
Choose one of the relations—S, say—and include as a foreign key in S
the primary key of T.
We include the primary key of the EMPLOYEE relation as foreign key
in the DEPARTMENT relation and rename it Mgr_ssn.
Aruna Devi.C (DSCASC)
65. Relational Database Design Using ER-to-Relational Mapping (Cont.,)
b. Merged relation approach:
An alternative mapping of a 1:1 relationship type is to merge the two entity types
and the relationship into a single relation.
c. Cross-reference or relationship relation approach:
The third option is to set up a third relation R for the purpose of cross-
referencing the primary keys of the two relations S and T representing the entity
types.
Aruna Devi.C (DSCASC)
66. Relational Database Design Using ER-to-Relational Mapping (Cont.,)
Step 4: Mapping of Binary 1:N Relationship Types:
For each regular binary 1:N relationship type R, identify the relation S that
represents the participating entity type at the N-side of the relationship type.
Include any simple attributes (or simple components of composite attributes) of
the 1:N relationship type as attributes of S.
Example, we now map the 1:N relationship types WORKS_FOR, CONTROLS, and
SUPERVISION from Figure 1.
For WORKS_FOR we include the primary key Dnumber of the DEPARTMENT
relation as foreign key in the EMPLOYEE relation and call it Dno.
For SUPERVISION we include the primary key of the EMPLOYEE relation as
foreign key in the EMPLOYEE relation itself—because the relationship is
recursive— and call it Super_ssn.
67. Relational Database Design Using ER-to-Relational Mapping (Cont.,)
Step 5: Mapping of Binary M:N Relationship Types:
For each binary M:N relationship type R, create a new relation S to represent R.
Include as foreign key attributes in S the primary keys of the relations that
represent the participating entity types; their combination will form the primary
key of S.
Example, we map the M:N relationship type WORKS_ON from Figure 1 by
creating the relation WORKS_ON in Figure 2.
We include the primary keys of the PROJECT and EMPLOYEE relations as foreign
keys in WORKS_ON and rename them Pno and Essn, respectively.
68. Relational Database Design Using ER-to-Relational Mapping (Cont.,)
Step 6: Mapping of Multi valued Attributes:
For each multi valued attribute A, create a new relation R.
This relation R will include an attribute corresponding to A, plus the primary key
attribute K—as a foreign key in R—of the relation that represents the entity type
or relationship type that has A as a multi valued attribute.
The primary key of R is the combination of A and K.
Example, we create a relation DEPT_LOCATIONS.
Aruna Devi.C (DSCASC)
69. Relational Database Design Using ER-to-Relational Mapping (Cont.,)
The attribute Dlocation represents the multivalued attribute LOCATIONS of
DEPARTMENT, while Dnumber—as foreign key—represents the primary key
of the DEPARTMENT relation.
The primary key of DEPT_LOCATIONS is the combination of {Dnumber,
Dlocation}.
Aruna Devi.C (DSCASC)
70. Relational Database Design Using ER-to-Relational Mapping (Cont.,)
Step 7: Mapping of N-ary Relationship Types:
For each n-ary relationship type R, where n > 2, create a new relation S to
represent R.
Include as foreign key attributes in S the primary keys of the relations that
represent the participating entity types.
The primary key of S is usually a combination of all the foreign keys that
reference the relations representing the participating entity types.
Aruna Devi.C (DSCASC)
71. Summary of Mapping constructs and constraints
Table : Correspondence between ER and Relational Models
ER Model Relational Model
Entity type “Entity” relation
1:1 or 1:N relationship type Foreign key (or “relationship” relation)
M:N relationship type “Relationship” relation and two foreign keys
n-ary relationship type “Relationship” relation and n foreign keys
Simple attribute Attribute
Composite attribute Set of simple component attributes
Multivalued attribute Relation and foreign key
Value set Domain
Key attribute Primary (or secondary) key
Aruna Devi.C (DSCASC)