Questions tagged [relational-calculus]

15 questions
1
vote
1 answer

Relational calculus to SQL

I am somewhat aware of the correspondence between (tuple and domain) relational calculus, relational algebra, and SQL. To the best of my understanding, one should be able to automatically convert a formula in relational calculus to an SQL query…
1
vote
0 answers

Relational calculus: "Find all X with at least y amount of Z"

Assuming I have two relations: Supplier [ID (PK), Name, City, Country] and Item [ID (PK), Name, Department, Price, Stock, Supplier_ID (FK)] What would be the easiest way to determine the following statement both in domain and tuple relational…
1
vote
0 answers

Division in tuple relational calculus

$ \newcommand{\Set}[2]{% \{\, #1 \mid #2 \, \}% }$ I've been trying to find how to express relational division operation in tuple relational calculus. The only thing I found is this presentation where on the page 4 it is said that for relations $R…
1
vote
1 answer

Check if a relation is reflexive, symmetric and transitive

I want to better understand how this actually works, as my solutions are sometimes not 100% correct. I have the following relation: Check if the following relation is reflexive, symmetric, and/or transitive: $$ R_1 = \{ (x,y) \mid x,y \in…
0
votes
0 answers

Relational calculus expression for projection (Database Management)

I recently came across this question: Let the following relation schemas be given: $R=(A,B,C)$ $S=(D,E,F)$ Let relations r(R) and s(S) be given. Give an expression in the tuple relational calculus that is equivalent to the following: a.…
0
votes
1 answer

Use of existential quantifier in tuple relational calculus

It is somewhat confusing to me when to use quantifiers in tuple relational calculus (TRC). I stumbled upon following problem and I am still scratching my head thinking why not TRC query can be constructed without using existential quantifier. The…
0
votes
2 answers

Logical equivalence priority

I have the logical formula $$ A \Leftrightarrow B \Leftrightarrow C $$ In order to make the truth table I'm not sure wheither I should interpret it as $A \Leftrightarrow B \Leftrightarrow C$ or $A \Leftrightarrow (B \Leftrightarrow C)$ Here is my…
0
votes
0 answers

Is it possible to convert any relational algebra expression into a relational calculus expression?

Let's for the sake of simplicity only focus on tuple relational calculus. Every relational algebra query can be broken down into the 5 atomic operations - projection, selection, set union, set difference, cartesian product (I'm excluding renaming as…
0
votes
1 answer

Tuple relational calculus: existential quantifiers

I have the following question and given answer: Question: List the names of managers who have at least one dependant. Answer: {e.Fname, e.Lname | EMPLOYEE(e) AND (∃d)(∃t)(DEPARTMENT(d) AND DEPENDANT(t) AND e.Ssn = d.Mgrssn AND t.Essn = e.Ssn) } My…
0
votes
0 answers

Relation Closure for F+

$A \rightarrow B C$ $C D \rightarrow E$ $B \rightarrow D$ $E \rightarrow A$ I have these Relations for R={A,B,C,D,E} Now I have to calculate the closure $F^+$ and give the candidate keys I came to these relations $A \rightarrow A$ $A \rightarrow…
0
votes
1 answer

Need help understanding the tuple relational calculus

We say that a query in a TRC is a statement of the form $\{T: P(T)\}$, where $T$ is a tuple variable and $P(T)$ is a formula. Now my question is, what are the possible tuples $T$ to be tested i.e., what are the types and values for tested…
0
votes
1 answer

Normal form after decomposition of a relation

I came across a text recently which claims that if we perform a lossless decomposition of a relation R into smaller relations R1 and R2, and if R is in 3NF, both R1 and R2 are 3NF. I felt a bit suspicious regarding this claim, but couldn't find…
0
votes
1 answer

Whether same output is obtained for the two queries

Consider the following SQL Queries executed on the relation Employee: Employee (Eid, Ename, sal) Eid is the primary key Queries: S1:SELECT count (*) FROM Employee; S2: SELECT count (Eid) FROM Employee; Will these queries return the same result…
0
votes
1 answer

Normal form of relation R

It is given that for a relation R all the attributes of the relation appear in some of the candidate keys. It is also given that there is only one compound candidate key which exists for a relation, all the other candidate keys are simple candidate…
-1
votes
2 answers

Intuition for a projection in tuple relational calculus

Let's have a relation $R = (name, surname, age)$. I want to obtain a new relation with only the $name$ attribute. In relational algebra I would simply do $\Pi_{\mathrm{name}}(R)$ but in relational calculus the general way of doing that…