## What is the suitable file structure for database if queries are select (relational algebra) operations only?

Searches related to A relation R(A, B, C, D) has to be accessed under the query σB=10(R). Out of the following possible ﬁle structures, which one should be chosen and why? i. R is a heap ﬁle. ii. R has a clustered hash index on B. iii. R has an unclustered B+ tree index on (A, B).

## how to get rows with more than 1 appearance of a specific column in relational algebra

I have a table like this:

PostId   |    Body    |    AuthorId    2             b               F   2             b               E   4             d               A   4             d               E   8             h               F  

So what I want is to get all the rows that have more that 1 appearance of PostId. Here the result would be 2 and 4 because they appear more than 1 time. I want this in relational algebra.
I have already a relation that works just fine but in this relation I use aggregation methods and I don’t really what to use count in my relation. I am wondering if there is a way to this with subtraction or division operators?
What I do for now is π PostId (σ c ≥ 2 ( γ Body; COUNT(PostId)->c R2)) to get the row with more than 1 appearance of PostId.

## Relational Algebra Queries look same

Query A and Query C seem to be the same.But given answer is query A. Can someone help me to find the difference between queries A and C ?

## Testing whether polynomial is in algebra of other polynomials

A collection $$\Sigma$$ of polynomials is an algebra if: (1) $$\lambda f + \eta g \in \Sigma$$ for any $$f,g \in \Sigma, \lambda,\eta \in \mathbb{R}$$ and (2) $$f,g \in \Sigma$$ implies $$fg \in \Sigma$$. We say that $$P$$ is in the algebra of $$\{P_1,\dots,P_n\}$$ if $$P$$ is in the smallest algebra containing $$P_1,\dots,P_n$$.

I was wondering if there was a way, on any computer math software, to check whether a given $$P$$ as in the algebra of a given collection $$P_1,\dots,P_n$$.

Example: take $$n \ge 1$$ and let $$P_1 = x_1+\dots+x_n, P_2 = x_1^2+\dots+x_n^2,\dots P_n = x_1^n+\dots+x_n^n$$. Then all $$n$$ of the following symmetric functions are in the algebra generated by $$P_1,\dots,P_n$$: $$x_1+\dots+x_n$$ $$x_1x_2+\dots+x_{n-1}x_n$$ $$x_1x_2x_3+\dots+x_{n-2}x_{n-1}x_n$$ $$\dots$$ $$x_1\dots x_n$$

I’d appreciate any help.

## Simplifying a logic function using Boolean algebra

Consider this Logic function : D = A B C + A B’ C + A’ B’ C + A B C’ + A’ B C’ + A B’ C’ I am trying to simplify it using Boolean algebra , I am stuck in this step : D= AB +B’C+ A’ B C’ + A B’ C’ So how do I continue simplifying it ?

## Is relational algebra a procedural, imperative, and/or declarative language?

In Database System Concepts 6ed,

6.2 The Tuple Relational Calculus

When we write a relational-algebra expression, we provide a sequence of procedures that generates the answer to our query.

The tuple relational calculus, by contrast, is a nonprocedural query language. It describes the desired information without giving a speciﬁc procedure for obtaining that information. A query in the tuple relational calculus is expressed as: {t | P(t)}. That is, it is the set of all tuples t such that predicate P is true for t.

Does the above mean that relational algebra is a procedural language?

Is relational algebra a declarative language?

Is the tuple relational calculus a declarative language?

Is the tuple relational calculus more declarative than relational algebra is?

Is a procedural language an imperative language? (This is always what I heard, but I also heard that SQL is a declarative language (so is relational algebra) so is not imperative.)

What is the correct or most reasonable or most accepted definition of procedural languages, imperative languages, and declarative languages?

Thanks.

## Using relational algebra to express all with a condition

I encountered this question while revising for my finals exam on database theory.

The following database contains information about car repair workshops. The following tables are used:

$$Workshop(\underline{rname})\ Car(\underline{cname},make,model)\ Repairs(\underline{rname,cname},price)$$

Given two workshops $$W_1$$ and $$W_2$$, $$W_1$$ is more expensive than $$W_2$$ if for every car $$C$$ that is repaired by both $$W_1$$ and $$W_2$$, the repair price for $$W_1$$ is higher than the repair price for $$W_2$$ for $$C$$. Write a relational algebra query to find all workshops $$(W_1, W_2)$$ where $$W_1$$ is more expensive than $$W_2$$. Exclude workshops that do not repair any common cars.

I attempted to use a join naively:

1. $$\rho_{(w1,car,c1)}(Repairs) \bowtie_{car} \rho{(w2,car,c2)} \rightarrow A$$
2. $$\sigma_{c1 > c2}(A) \rightarrow B$$

And then simply project out the $$rname$$ on a join with $$Workshop$$. However, I realised that there would exist some Repairs where $$c1 < c2$$ and $$c1 > c2$$ are both present, and it would still indicate that $$W_1$$ is more expensive than $$W_2$$.

I am thinking of using the division $$\text{\}$$ operator, but I am not sure how to proceed.

## Looking for good book similar Stability/Conditioning in Numerical Linear Algebra,

I am currently reading Numerical Linear Algebra by Trefethen and Bau and I am finding it quite difficult to read. In particular, I have been trying to read the sections on Floating Point Arithmetic, Stability, and Conditioning, and they are pretty confusing to me; it has taken me 3-4 hours to go through the four pages on floating point arithmetic, and there are still a couple things I am unclear on.

I am looking for a book which goes over similar material as Trefefthen and Bau, but which fleshes things out a bit more.

My background is: I am a student of pure mathematics. I am a complete layman when it comes to computers.

Thanks!

## Addition, multiplication, and apostrophe used to represent boolean algebra expressions?

I’m looking at a worksheet that expresses boolean logic expressions using multiplication, addition, and apostrophes; something I’ve never seen before.

I can make a guess that the apostrophe is equivalent to ¬ (except it’s suffixed instead of prefixed). But I’m not sure what the addition and multiplication of the variables/propositional atoms would mean. Furthermore, I don’t know how a boolean logic formula can “output” something other than just a truth value…

I can’t seem to piece together with certainty the meaning of this representation. Could anyone take a look at the below example and maybe make a guess as to a translation of this representation to the more traditional ^, v, and ¬ symbols?

This arose in the context of digital logic in terms of logic gates and such on a CPU, if that makes a difference.

An alleged truth table of the above two expressions (the first row is filled in as an example):

## Consulta Sobre Algebra Relacional

Me dan las siguientes tablas:

Producto<nombreProducto, tipo, precio, esParaDiabetico, esDietetico> Persona<DNI, nombre, edad, estadoCivil, profesion> Fabrica<nombreProducto, nombreFabrica, produccionEnPesos, ciudad> Regalos<DNIRegalador, DNiReceptor, nombreProducto, fecha> 

Como puedo saber todos los productos que han sido regalados a todas la personas existentes en la base de datos?

Gracias de antemano.