Sub query example with advantage and disadvantagesSarfaraz Ghanta
it describes about the example of the subquery with advantages as well as disadvantages.
it sows the syntax and example of thew insert , select, update, delete query.
Aggregating Data Using Group FunctionsSalman Memon
After completing this lesson, you should be able to
do the following:
Identify the available group functions
Describe the use of group functions
Group data using the GROUP BY clause
Include or exclude grouped rows by using the HAVING clause
http://phpexecutor.com
Sub query example with advantage and disadvantagesSarfaraz Ghanta
it describes about the example of the subquery with advantages as well as disadvantages.
it sows the syntax and example of thew insert , select, update, delete query.
Aggregating Data Using Group FunctionsSalman Memon
After completing this lesson, you should be able to
do the following:
Identify the available group functions
Describe the use of group functions
Group data using the GROUP BY clause
Include or exclude grouped rows by using the HAVING clause
http://phpexecutor.com
Semantic analysis is a pass by a compiler that adds semantic information to the parse tree and performs certain checks based on this information. It logically follows the parsing phase, in which the parse tree is generated, and logically precedes the code generation phase, in which executable code is generated.
With a pre-requisite of ensuring an application's flawless functioning, this PPT sheds light on what functional testing entails with its importance to enhance an application's quality. Get to know more on Functional Testing Services, Functional Testing Types, Smoke Testing, Sanity Testing, Regression Testing with this presentation and stay tuned for our upcoming ones.
presentation contains the most important part of the software development engineering which is Requirement Analysis and Specification.
Take a look may be it is helpfull for you.
Thank you
This presentation describes:
- What is software size?
- How to Measure Software size?
- Techniques and parameters in Software Size estimation
- Where and how to apply the techniques?
Semantic analysis is a pass by a compiler that adds semantic information to the parse tree and performs certain checks based on this information. It logically follows the parsing phase, in which the parse tree is generated, and logically precedes the code generation phase, in which executable code is generated.
With a pre-requisite of ensuring an application's flawless functioning, this PPT sheds light on what functional testing entails with its importance to enhance an application's quality. Get to know more on Functional Testing Services, Functional Testing Types, Smoke Testing, Sanity Testing, Regression Testing with this presentation and stay tuned for our upcoming ones.
presentation contains the most important part of the software development engineering which is Requirement Analysis and Specification.
Take a look may be it is helpfull for you.
Thank you
This presentation describes:
- What is software size?
- How to Measure Software size?
- Techniques and parameters in Software Size estimation
- Where and how to apply the techniques?
FellowBuddy.com is an innovative platform that brings students together to share notes, exam papers, study guides, project reports and presentation for upcoming exams.
We connect Students who have an understanding of course material with Students who need help.
Benefits:-
# Students can catch up on notes they missed because of an absence.
# Underachievers can find peer developed notes that break down lecture and study material in a way that they can understand
# Students can earn better grades, save time and study effectively
Our Vision & Mission – Simplifying Students Life
Our Belief – “The great breakthrough in your life comes when you realize it, that you can learn anything you need to learn; to accomplish any goal that you have set for yourself. This means there are no limits on what you can be, have or do.”
Like Us - https://www.facebook.com/FellowBuddycom
Data Structure is a way of collecting and organising data in such a way that we can perform operations on these data in an effective way. Data Structures is about rendering data elements in terms of some relationship, for better organization and storage. For example, we have data player's name "Virat" and age 26. Here "Virat" is of String data type and 26 is of integer data type.
We can organize this data as a record like Player record. Now we can collect and store player's records in a file or database as a data structure. For example: "Dhoni" 30, "Gambhir" 31, "Sehwag" 33
In simple language, Data Structures are structures programmed to store ordered data, so that various operations can be performed on it easily.
Christoph Koch is a professor of Computer Science at EPFL, specializing in data management. Until 2010, he was an Associate Professor in the Department of Computer Science at Cornell University. Previously to this, from 2005 to 2007, he was an Associate Professor of Computer Science at Saarland University. Earlier, he obtained his PhD in Artificial Intelligence from TU Vienna and CERN (2001), was a postdoctoral researcher at TU Vienna and the University of Edinburgh (2001-2003), and an assistant professor at TU Vienna (2003-2005). He has won Best Paper Awards at PODS 2002, ICALP 2005, and SIGMOD 2011, an Outrageous Ideas and Vision Paper Award at CIDR 2013, a Google Research Award (in 2009), and an ERC Grant (in 2011). He is a PI of the FET Flagship Human Brain Project and of NCCR MARVEL, a new Swiss national research center for materials research. He (co-)chaired the program committees of DBPL 2005, WebDB 2008, ICDE 2011, VLDB 2013, and was PC vice-chair of ICDE 2008 and ICDE 2009. He has served on the editorial board of ACM Transactions on Internet Technology and as Editor-in-Chief of PVLDB.
The paper examines the problem of systems redesign within the context of passive electrical networks and through analogies provides also the means of addressing issues of re-design of mechanical networks. The problem addressed here are special cases of the more general network redesign problem. Redesigning autonomous passive electric networks involves changing the network natural dynamics by modification of the types of elements, possibly their values, interconnection topology and possibly addition, or elimination of parts of the network. We investigate the modelling of systems, whose structure is not fixed but evolves during the system lifecycle. As such, this is a problem that differs considerably from a standard control problem, since it involves changing the system itself without control and aims to achieve the desirable system properties, as these may be expressed by the natural frequencies by system re-engineering. In fact, this problem involves the selection of alternative values for dynamic elements and non-dynamic elements within a fixed interconnection topology and/or alteration of the network interconnection topology and possible evolution of the cardinality of physical elements (increase of elements, branches). The aim of the paper is to define an appropriate representation framework that allows the deployment of control theoretic tools for the re-engineering of properties of a given network. We use impedance and admittance modelling for passive electrical networks and develop a systems framework that is capable of addressing “life-cycle design issues” of networks where the problems of alteration of existing topology and values of the elements, as well as issues of growth, or death of parts of the network are addressed.
We use the Natural Impedance/ Admittance (NI-A) models and we establish a representation of the different types of transformations on such models. This representation provides the means for an appropriate formulation of natural frequencies assignment using the Determinantal Assignment Problem framework defined on appropriate structured transformations. The developed natural representation of transformations are expressed as additive structured transformations. For the simpler case of RL or RC networks it is shown that the single parameter variation problem (dynamic or non-dynamic) is equivalent to Root Locus problems.
follow IEEE NTUA SB on facebook:
https://www.facebook.com/IeeeNtuaSB
JCConf 2020 - New Java Features Released in 2020Joseph Kuo
In 2020, Java 14 and 15 are released with many great features, including ZGC, Shenandoah GC, helpful NullPointerExceptions, pattern matching for instanceof, switch expressions, text blocks, records, hidden classes, and sealed classes. They not only improve performance of GC and Java applications, but also introduce new syntax to ease our effort to write more readable and efficient code. Let's take a look at those features!
https://cyberjos.blog/java/seminar/jcconf-2020-new-java-features-released-in-2020/
JThermodynamicsCloud is software service for the chemical, or more specifically, the combustion research
domain. JThermodynamicsCloud service can be said to be an model driven application, where the ontology
is a platform independent model of the data and operational structures. The ontology, as used by the service,
has three distinct purposes: documentation, data structure definition and operational definitions. One goal of
the ontology is to place as much of the design and domain specific structures in the ontology rather than in
the application code. The application code interprets the ontology in the backend. The primary purpose of
the JThermodynamicsCloud is to perform thermdynamic calculations and manage the data needed to make
those calculations. The calculation itself is highly dependent on the varied types of molecular data found in
the database The complete service is a system with three interacting components, a user interface using
Angular, a (RESTful) backend written in JAVA (with the JENA API interpreting the ontology) and the
Google Firestore noSQL document database and Firebase storage. The service uses these three components
to make calculations for thermodynamic quantities based on molecular species structure. These different
platforms are united through the ontology.
JThermodynamicsCloud is software service for the chemical, or more specifically, the combustion research
domain. JThermodynamicsCloud service can be said to be an model driven application, where the ontology
is a platform independent model of the data and operational structures. The ontology, as used by the service,
has three distinct purposes: documentation, data structure definition and operational definitions. One goal of
the ontology is to place as much of the design and domain specific structures in the ontology rather than in
the application code. The application code interprets the ontology in the backend. The primary purpose of
the JThermodynamicsCloud is to perform thermdynamic calculations and manage the data needed to make
those calculations. The calculation itself is highly dependent on the varied types of molecular data found in
the database The complete service is a system with three interacting components, a user interface using
Angular, a (RESTful) backend written in JAVA (with the JENA API interpreting the ontology) and the
Google Firestore noSQL document database and Firebase storage. The service uses these three components
to make calculations for thermodynamic quantities based on molecular species structure. These different
platforms are united through the ontology.
JThermodynamicsCloud is software service for the chemical, or more specifically, the combustion research
domain. JThermodynamicsCloud service can be said to be an model driven application, where the ontology
is a platform independent model of the data and operational structures. The ontology, as used by the service,
has three distinct purposes: documentation, data structure definition and operational definitions. One goal of
the ontology is to place as much of the design and domain specific structures in the ontology rather than in
the application code. The application code interprets the ontology in the backend. The primary purpose of
the JThermodynamicsCloud is to perform thermdynamic calculations and manage the data needed to make
those calculations. The calculation itself is highly dependent on the varied types of molecular data found in
the database The complete service is a system with three interacting components, a user interface using
Angular, a (RESTful) backend written in JAVA (with the JENA API interpreting the ontology) and the
Google Firestore noSQL document database and Firebase storage. The service uses these three components
to make calculations for thermodynamic quantities based on molecular species structure. These different
platforms are united through the ontology.
ChemConnect: Poster for European Combustion Meeting 2017Edward Blurock
This is a poster presented at the European Combustion Meeting, April 2017. It explains the Reference Description Language (RDF) setup of the database and the direction and development of the ChemConnect database project as an efficient means of data retrieval and data exhange and how the project is moving towards being an Electronic Laboratory Notebook (ELN).
EU COST Action CM1404: WG€ - Efficient Data ExchangeEdward Blurock
This talk discusses the topic of data exchange within the combustion community. This is a summary of a task force on data exchange within the WG4 working group, Standard definition for data collection and mining toward a virtual chemistry of Smart Energy Carriers, within the SMARTCATS EU COST Action CM1404
ChemConnect: Characterizing CombusAon KineAc Data with ontologies and meta-‐...Edward Blurock
ChemConnect is a database that interconnects fine-grained information extracted from chemical kinetic and thermodynamic sources such as
CHEMKIN mechanism files, NASA polynomial files, and even the information behind automatic generation files.
The key to the interconnection is the Resource Description Framework (RDF) from Semantic Web technologies. The RDF is a triplet where an object item (first) is associated through a descriptor (second) to a subject item.
In this way the information of the object is connected (through the descriptor) to the subject.
In ChemConnect the object is word (text) and the subject can be text or a database item. The search mechanism within ChemConnect uses the object and subject text as search strings.
The presentation also contains an brief introduction to cloud computing.
This was presented at the COST Action 1404 SMARTCATS workshop on Databases and Systems Use Cases (http//http://www.smartcats.eu/wg4ws1dp/)
Poster: Characterizing Ignition behavior through morphing to generic curvesEdward Blurock
The qualitative notion that ignition processes have similar behavior, even over an extensive range of starting conditions, is quantitatively demonstrated through the production of a single ’generic’ ignition curve. The key to the production of the generic curve is the recognition that the basic shapes of the species and temperature profiles occurring in the ignition process differ only in their ’timing’. By ’morphing’ the time scale, the profile shapes can be made to align. From the aligned profile shapes a generic or ’average’ profile can be derived. Synchronizing chemical events modifies the ignition progress times. In addition to fixing the ignition time to have the progress value of one, intermediate ignition events (such as selected profile maxima or inflection points) that occur before ignition are also aligned to have specific ’normalized’ times.
The goal of the Very Open Data Project is to provide a software-technical foundation for this exchange of data, more specifically to provide an open database platform for data from the raw data coming from experimental measurements or models through intermediate manipulations to finally published results. The sheer expanse of the amount data involved creates some unique software-technical challenges. One of these challenges is addressed in the part of the study presented here, namely to characterize scientific data (with the initial focus being detailed chemistry data from the combustion kinetic community), so that efficient searches can be made. A formalization of this characterization comes in the form of schemas of descriptions of tags and keywords describing data and ontologies describing the relationship between data types and the relationship between the characterizations themselves. These will be translated to meta-data tags connected to the data points within a non-relational data of data for the community.
The focus of the initial work will be on data and its accessibility. As the project progresses, the emphasis will shift on not only having available data accessible for the community, but that the community itself will be able to, with emphasis on minimal effort, will be able contribute their own data. This will involve, for example, the concepts of the ‘electronic lab notebook’ and the existence and availability of extensive concept extraction tools, primarily from the chemical informatics field.
This describes a tabulation method based on computing, retaining and accessing a large, on the order of millions, number of individual kinetic time step calculations and approximations. It is essentially an extension of Pope’s In Situ Adaptive Tabulation
(ISAT) method. The primary differences lie in that not all configurations need be stored in memory and that a polynomial approximation is only calculated when enough points have accumulated within a localized area to be able to calculate the
polynomial approximation. The latter increases efficiency because no extra points are evaluated to form an approximation (as is done in ISAT). The speed up is expected to be that of ISAT.
Characterization Ignition Behavior through Morphing to Generic Ignition CurvesEdward Blurock
Presented at the International Conference of Chemical Kinetics, Ghent, Belgium, July, 2015
The qualitative notion that ignition processes have similar behavior, even over an extensive range of starting conditions, is quantitatively demonstrated through the production of a single ’generic’ ignition curve. The key to the production of the generic curve is the recognition that the basic shapes of the species and temperature profiles occurring in the ignition process differ only in their ’timing’. By ’morphing’ the time scale, the profile shapes can be made to align. From the aligned profile shapes, a generic or ’average’ profile can be derived. Synchronizing chemical events modifies the ignition progress times. In addition to fixing the ignition time to have the progress value of one, intermediate ignition events (such as selected profile maxima or inflection points) that occur before ignition are also aligned to have specific ’normalized’ times. With this additional synchronization, a single generic curve, derived from the average of the morphed curves, can be derived. This generic curve represents a kinetic modelers intuitive notion of the mechanism of the process.
Course: Programming Languages and Paradigms:
A brief introduction to imperative programming principles: history, von neumann, BNF, variables (r-values, l-values), modifiable data structures, order of evaluation, static and dynamic scopes, referencing environments, call by value, control flow (sequencing, selection, iteration), ...
Course: Programming Languages and Paradigms:
This introduces concepts related to programming languate design: abstraction, a bit of history, the syntax, semantics and pragmatics of programming languages, languages as abstraction, thought shaper, simplifier and law enforcer.program verification, denotational and operational semantics
Course: Intro to Computer Science (Malmö Högskola):
knowledge representation and abstraction, decision making, generalization, data acquistion (abstraction), machine learning, similarity
another version of abstraction
Course: Intro to Computer Science (Malmö Högskola):
A very general overview of computer science from machine, operating systems, networks, applications...
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
How to Add Chatter in the odoo 17 ERP ModuleCeline George
In Odoo, the chatter is like a chat tool that helps you work together on records. You can leave notes and track things, making it easier to talk with your team and partners. Inside chatter, all communication history, activity, and changes will be displayed.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
The simplified electron and muon model, Oscillating Spacetime: The Foundation...RitikBhardwaj56
Discover the Simplified Electron and Muon Model: A New Wave-Based Approach to Understanding Particles delves into a groundbreaking theory that presents electrons and muons as rotating soliton waves within oscillating spacetime. Geared towards students, researchers, and science buffs, this book breaks down complex ideas into simple explanations. It covers topics such as electron waves, temporal dynamics, and the implications of this model on particle physics. With clear illustrations and easy-to-follow explanations, readers will gain a new outlook on the universe's fundamental nature.
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
2. Data Models
• A Database models some
portion of the real world.
• Data Model is link between
user’s view of the world and
bits stored in computer.
• Many models have been
proposed.
• We will concentrate on the
Relational Model.
10101
11101
Student (sid: string, name: string, login:
string, age: integer, gpa:real)
3. Describing Data:
Data Models
• A data model is a collection of concepts for
describing data.
• A database schema is a description of a
particular collection of data, using a given data
model.
• The relational model of data is the most widely
used model today.
o Main concept: relation, basically a table with rows and columns.
o Every relation has a schema, which describes the columns, or fields.
4. Need to design a
data model
Data Model
A data schema
Need to model the business
5. Relational Query
Languages
• Query languages:
o Allow manipulation and retrieval of data from a database.
• Relational model supports simple,
powerful QLs:
o Strong formal foundation based on logic.
o Allows for much optimization.
• Query Languages != programming
languages!
o QLs not expected to be “Turing complete”.
o QLs not intended to be used for complex calculations.
o QLs support easy, efficient access to large data sets.
6. Formal Relational Query
Languages
Two mathematical Query Languages form the
basis for “real” languages (e.g. SQL), and for
implementation:
¶ Relational Algebra: More operational, very
useful for representing execution plans.
· Relational Calculus: Lets users describe what
they want, rather than how to compute it.
· (Non-operational, declarative.)
* Understanding Algebra & Calculus is key to
* understanding SQL, query processing!
7. Relational Database:
Definitions
• Relational database: a set of relations.
• Relation: made up of 2 parts:
o Schema : specifies name of relation, plus name
and type of each column.
• E.g. Students(sid: string, name: string, login:
string, age: integer, gpa: real)
o Instance : a table, with rows and columns.
• #rows = cardinality
• #fields = degree / arity
• Can think of a relation as a set of rows or tuples.
o i.e., all rows are distinct
8. Set and Bag
A set of objects….
Formal distinction
Set:
All objects in the “set” are unique
If the objects are not unique, then it is a
Bag
9. Preliminaries
• A query is applied to relation instances, and the
result of a query is also a relation instance.
o Schemas of input relations for a query are fixed (but query will run
regardless of instance!)
o The schema for the result of a given query is also fixed! Determined by
definition of query language constructs.
• Positional vs. named-field notation:
o Positional notation easier for formal definitions, named-field notation more
readable.
o Both used in SQL
10. Algebra
• In math, algebraic operations like +, -, x, /.
• Operate on numbers: input are numbers, output are
numbers.
• Can also do Boolean algebra on sets, using union,
intersect, difference.
• Focus on algebraic identities, e.g.
o x (y+z) = xy + xz.
• (Relational algebra lies between propositional and 1st-order logic.)
3
4
7+
11. Relational Algebra
• Every operator takes one or two relation instances
• Result is also a relation
A relational algebra expression is a relation
Algebra is closed
F( R ) -> R
F(R1,R2) -> R
12. 12
Relational Algebra in a
DBMS
parser
SQL
query
Relational
algebra
expression
Optimized
Relational
algebra
expression
Query optimizer
Code
generator
Query
execution
plan
Executable
code
DBMS
13. Introduction to Relational Algebra
• Introduced by E. F.
Codd in 1970.
• Codd proposed such
an algebra as a basis
for database query
languages.
14. Terminology
• Relation - a set of tuples.
• Tuple - a collection of attributes which describe
some real world entity.
• Attribute - a real world role played by a named
domain.
• Domain - a set of atomic values.
• Set - a mathematical definition for a collection of
objects which contains no duplicates.
15. Relational Algebra
• Basic operations:
o Selection ( 𝛔) Selects a subset of rows from relation.
o Projection ( π) Deletes unwanted columns from relation.
o Cross-product ( X ) Allows us to combine two relations.
o Set-difference ( - ) Tuples in reln. 1, but not in reln. 2.
o Union ( U ) Tuples in reln. 1 and in reln. 2.
• Additional operations:
o Intersection, join, division, renaming: Not essential, but (very!) useful.
16. Closed Algebra
Since each operation returns a relation, operations
can be composed! (Algebra is “closed”.)
All these operations have a relation instance as input
And all these operations give an instance relation as output
18. 18
Projection
R1 := PROJL (R2)
R1 := πL (R2)
• L is a list of attributes from the schema of R2.
• R1 is constructed by looking at each tuple of R2,
extracting the attributes on list L, in the order
specified, and creating from those components a
tuple for R1.
• Eliminate duplicate tuples, if any.
19. Projection
• Deletes attributes that are not in projection list.
• Schema of result contains exactly the fields in the
projection list, with the same names that they had in
the (only) input relation.
sname rating
S
,
( )2
Schema: Result(sname,rating)
20. Projection
sname rating
yuppy 9
lubber 8
guppy 5
rusty 10
sname rating
S
,
( )2
• Deletes attributes that are not in projection list.
sid sname rating age
28 yuppy 9 35.0
31 lubber 8 55.5
44 guppy 5 35.0
58 rusty 10 35.0
Schema: Result(sname,rating)
21. Projection
age
35.0
55.5
age S( )2
• Deletes attributes that are not in projection list.
sid sname rating age
28 yuppy 9 35.0
31 lubber 8 55.5
44 guppy 5 35.0
58 rusty 10 35.0
Schema: Result(age)
Duplicates are eliminated
(sets not bags)
22. 22
Selection
R1 := SELECTC (R2)
R1 := 𝛔C (R2)
• C is a condition (as in “if” statements) that refers to
attributes of R2.
• R1 is all those tuples of R2 that satisfy C.
24. Selection
rating
S
8
2( )
sid sname rating age
28 yuppy 9 35.0
58 rusty 10 35.0
Schema of result identical to schema of input relation.
sid sname rating age
28 yuppy 9 35.0
31 lubber 8 55.5
44 guppy 5 35.0
58 rusty 10 35.0
S2
Result(sid,sname,rating,age)
25. Composite
We have two operations
Each operation, 𝛔 and π, have relations as input
Each operation has a relation as output
i.e., Relational Algebra is closed
Thus we can combine them into composite functions
sname rating rating
S
,
( ( ))
8
2
31. Difference
sid sname rating age
22 dustin 7 45.0
31 lubber 8 55.5
58 rusty 10 35.0
sid sname rating age
28 yuppy 9 35.0
31 lubber 8 55.5
44 guppy 5 35.0
58 rusty 10 35.0
S1
S2
Compute: S1 - S2
Union Compatible Take away
Duplicates
sid sname rating age
22 dustin 7 45.0
S1(sid,sname,rating,age)
S2(sid,sname,rating,age)
Result(sid,sname,rating,age)
The same schema
32. Union, Intersection, Set-
Difference
sid sname rating age
22 dustin 7 45.0
31 lubber 8 55.5
58 rusty 10 35.0
44 guppy 5 35.0
28 yuppy 9 35.0
S S1 2
sid sname rating age
31 lubber 8 55.5
58 rusty 10 35.0
S S1 2
sid sname rating age
22 dustin 7 45.0
S S1 2
sid sname rating age
22 dustin 7 45.0
31 lubber 8 55.5
58 rusty 10 35.0
sid sname rating age
28 yuppy 9 35.0
31 lubber 8 55.5
44 guppy 5 35.0
58 rusty 10 35.0
S1
S2
All have the same schema
33. 33
Cross-Product
R3 := R1 * R2
• Pair each tuple t1 of R1 with each tuple t2 of R2.
• Concatenation t1 and t2 is a tuple of R3.
• Schema of R3 is the attributes of R1 and then R2, in order.
• But beware attribute A of the same name in R1 and R2:
use R1.A and R2.A (rename)
36. Cross-Product
• Each row of S1 is paired with each row of R1.
• Result schema has one field per field of S1 and R1,
with field names `inherited’ if possible.
• Conflict: Both S1 and R1 have a field called sid.
( ( , ), )C sid sid S R1 1 5 2 1 1
(sid) sname rating age (sid) bid day
22 dustin 7 45.0 22 101 10/10/96
22 dustin 7 45.0 58 103 11/12/96
31 lubber 8 55.5 22 101 10/10/96
31 lubber 8 55.5 58 103 11/12/96
58 rusty 10 35.0 22 101 10/10/96
58 rusty 10 35.0 58 103 11/12/96
* Renaming operator:
37. 37
Renaming
• The RENAME operator gives a new schema to a
relation.
• R1 := RENAMER1(A1,…,An)(R2) makes R1 be a relation
with attributes A1,…,An and the same tuples as
R2.
• Simplified notation: R1(A1,…,An) := R2.
39. Composite Functions
• Projection
• Selection
• Product
• Union
• Intersection
• Difference
Relation algebra is closed
Can form composite
function:
as our example before:
This is where the power of relation algebra
Comes into play
Can form useful composite functions:
Such as
Joins and Division
40. Conditional Joins
(Theta Join)
Select out rows of a cross product given a certain
condition
• Result schema same as that of cross-product.
• Sometimes called a theta-join.
R c S c R S ( )
Cross product
Selection
41. Joins
R c S c R S ( )
S R
S sid R sid
1 1
1 1
. .
1. Perform the cross product S1 x R1
2. The perform the selection
44. Joins
• Condition Join:
• Result schema same as that of cross-product.
• Fewer tuples than cross-product, might be able
to compute more efficiently
• Sometimes called a theta-join.
R c S c R S ( )
(sid) sname rating age (sid) bid day
22 dustin 7 45.0 58 103 11/12/96
31 lubber 8 55.5 58 103 11/12/96
S R
S sid R sid
1 1
1 1
. .
45. Conditional Joins
Special Case: Equi-Join)
The condition is equality
Selects out those rows where a attributes are the same
• (for example, two primary keys)
• Again, result schema same as that of cross-product.
R c S c R S ( )
Cross product
Selection
46. Joins
R c S c R S ( )
1. Perform the cross product S1 x R1
2. The perform the selection R1.sid = S1.sid
S R
sid
1 1
49. Equi-Join
• Equi-Join: A special case of condition join where the
condition c contains only equalities.
• Result schema similar to cross-product,
• but only one copy of fields for which equality is
specified.
sid sname rating age bid day
22 dustin 7 45.0 101 10/10/96
58 rusty 10 35.0 103 11/12/96
S R
sid
1 1
50. Natural Join
• Natural Join: Equijoin on all common fields.
sid bid day
22 101 10/10/96
58 103 11/12/96
R1(sid,bid,day)
sid sname rating age
22 dustin 7 45.0
31 lubber 8 55.5
58 rusty 10 35.0
S1(sid,sname,rating,age)
sid sname rating age bid day
22 dustin 7 45.0 101 10/10/96
58 rusty 10 35.0 103 11/12/96
S1 R1
52. Division
• Not supported as a primitive operator, but useful for
expressing queries like:
Find sailors who have reserved all boats.
• Let A have 2 fields, x and y; B have only field y:
o A/B =
o i.e., A/B contains all x tuples (sailors) such that for every y tuple (boat) in B, there
is an xy tuple in A.
o Or: If the set of y values (boats) associated with an x value (sailor) in A contains all
y values in B, the x value is in A/B.
• In general, x and y can be any lists of fields; y is the list of
fields in B, and x y is the list of fields of A.
x x y A y B| ,
54. sno pno
s1 p1
s1 p2
s1 p3
s1 p4
s2 p1
s2 p2
s3 p2
s4 p2
s4 p4
Examples of Division A/B
pno
p2
sno
s1
s2
s3
s4
A
B1
A/B1Which have
p2 in A
55. Examples of Division A/B
sno pno
s1 p1
s1 p2
s1 p3
s1 p4
s2 p1
s2 p2
s3 p2
s4 p2
s4 p4
pno
p2
p4
sno
s1
s4
A
B2
A/B2
Which have both
p2 and p4
56. Examples of Division A/B
sno pno
s1 p1
s1 p2
s1 p3
s1 p4
s2 p1
s2 p2
s3 p2
s4 p2
s4 p4
pno
p1
p2
p4
sno
s1
A
B3
A/B3
Which has
p1, p2 and p4
57. Expressing A/B Using
Basic Operators
• Division is not essential op; just a useful shorthand.
o (Also true of joins, but joins are so common that systems implement joins
specially.)
• Idea: For A/B, compute all x values that are not
`disqualified’ by some y value in B.
o x value is disqualified if by attaching y value from B, we obtain an xy tuple that
is not in A.
Disqualified x values:
A/B:
x x A B A(( ( ) ) )
x A( ) all disqualified tuples
58. Expressing A/B Using
Basic Operators
x x A B A(( ( ) ) )
sno pno
s1 p1
s1 p2
s1 p3
s1 p4
s2 p1
s2 p2
s3 p2
s4 p2
s4 p4
pno
p2
p4
Select out sno from A
(note that only unique element
x is attributes unique to A
(not in B)
sno
Cross with B
has the same schema as A
Subtract rows that are
the same as A
Select out sno
This is the set of “disqualified” rows
59. Expressing A/B Using
Basic Operators
x x A B A(( ( ) ) )
sno pno
s1 p1
s1 p2
s1 p3
s1 p4
s2 p1
s2 p2
s3 p2
s4 p2
s4 p4
pno
p2
p4
This is the set of “disqualified”
x A( )
If something remains,
Then it is in the answer
sno
s1
s4
Subtract out disqualified tuples
60. SQL and
Relational Algebra
• Project
o SELECT X FROM TABLE
• Select
o select * from E where salary < 200
• Product
o select * from E, D
• Union
o UNION
• Intersection
o INTERSECT
61. 61
Schemas for Results
• Union, intersection, and difference: the schemas of
the two operands must be the same, so use that
schema for the result.
• Selection: schema of the result is the same as the
schema of the operand.
• Projection: list of attributes tells us the schema.
62. 62
Schemas for Results ---
(2)
• Product: schema is the attributes of both relations.
o Use R.A, etc., to distinguish two attributes named A.
• Theta-join: same as product.
• Natural join: union of the attributes of the two
relations.
• Renaming: the operator tells the schema.
67. Find names of sailors who’ve reserved a
red boat
• Information about boat color only available in Boats;
so need an extra join:
sname color red
Boats serves Sailors((
' '
) Re )
v A more efficient solution:
sname sid bid color red
Boats s Sailors( ((
' '
) Re ) )
* A query optimizer can find this given the first solution!
68. Find sailors who’ve reserved a red or a
green boat
• Can identify all red or green boats, then find
sailors who has reserved one of these boats:
( , (
' ' ' '
))Tempboats
color red color green
Boats
sname Tempboats serves Sailors( Re )
v What happens if is replaced by this query?
69. Find sailors who’ve reserved a red and a
green boat
• Previous approach won’t work! Must identify
sailors who’ve reserved red boats, sailors who’ve
reserved green boats, then find the intersection
(note that sid is a key for Sailors):
( , ((
' '
) Re ))Tempred
sid color red
Boats serves
sname Tempred Tempgreen Sailors(( ) )
( , ((
' '
) Re ))Tempgreen
sid color green
Boats serves
70. Find the names of sailors who’ve reserved all
boats
• Uses division; schemas of the input relations to /
must be carefully chosen:
( , (
,
Re ) / ( ))Tempsids
sid bid
serves
bid
Boats
sname Tempsids Sailors( )
v To find sailors who’ve reserved all ‘Interlake’ boats:
/ (
' '
)
bid bname Interlake
Boats
.....
71. 71
Duplicates
• Duplicate rows not allowed in a relation
• However, duplicate elimination from query result is
costly and not automatically done; it must be
explicitly requested:
SELECT DISTINCT …..
FROM …..
72. 72
Operations on Bags
• Selection applies to each tuple, so its effect on
bags is like its effect on sets.
• Projection also applies to each tuple, but as a bag
operator, we do not eliminate duplicates.
• Products and joins are done on each pair of tuples,
so duplicates in bags have no effect on how we
operate.
73. 73
Beware: Bag Laws != Set
Laws
• Some, but not all algebraic laws that hold for sets
also hold for bags.
• Example: the commutative law for union (R UNION
S = S UNION R ) does hold for bags.
o Since addition is commutative, adding the number of times x appears in R
and S doesn’t depend on the order of R and S.
74. Relational Algebra
• Relational Algebra and Relational Calculus have
substantial expressive power. In particular, they can
express
• Natural Join
• Quotient
• Unions of conjunctive queries
• …
• However, they Cannot Express recursive Queries.
75. 75
Equivalences
The same relational algebraic expression can be
written in many different ways. The order in which
tuples appear in relations is never significant.
• A B <=> B A
• A B <=> B A
• A B <=> B A
• (A - B) is not the same as (B - A)
• c1 ( c2 (A)) <=> c2 ( c1 (A)) <=> c1 ^ c2 (A)
• a1(A) <=> a1( a1,etc(A)) , where etc is any
attributes of A.
• ...
76. 76
Operations on Bags
(and why we care)
• Union: {a,b,b,c} U {a,b,b,b,e,f,f} =
{a,a,b,b,b,b,b,c,e,f,f}
o add the number of occurrences
• Difference: {a,b,b,b,c,c} – {b,c,c,c,d} = {a,b,b,d}
o subtract the number of occurrences
• Intersection: {a,b,b,b,c,c}∩{b,b,c,c,c,c,d} = {b,b,c,c}
o minimum of the two numbers of occurrences
• Selection: preserve the number of occurrences
• Projection: preserve the number of occurrences (no
duplicate elimination)
• Cartesian product, join: no duplicate elimination
78. Summary
• The relational model has rigorously defined query
languages that are simple and powerful.
• Relational algebra is more operational; useful as
internal representation for query evaluation plans.
• Several ways of expressing a given query; a query
optimizer should choose the most efficient version.