relational-algebra

Difference between Relational Algebra and Relational calculus

血红的双手。 提交于 2019-12-29 01:37:15
问题 What is the exact difference between relational algebra and relational calculus. At most of the reference, it will be Relational algebra is procedural and calculus is non procedural . So, what is these stands for. However, we can solve all the problems using relational algebra. Then why we would use relational calculus. Except definition, Explanation with example is much appreciated. 回答1: TL;DR: Queries calling RA (relational algebra) operators & queries of the two relational calculi (RCs)

Difference between Relational Algebra and Relational calculus

旧巷老猫 提交于 2019-12-29 01:35:53
问题 What is the exact difference between relational algebra and relational calculus. At most of the reference, it will be Relational algebra is procedural and calculus is non procedural . So, what is these stands for. However, we can solve all the problems using relational algebra. Then why we would use relational calculus. Except definition, Explanation with example is much appreciated. 回答1: TL;DR: Queries calling RA (relational algebra) operators & queries of the two relational calculi (RCs)

Understanding natural join in Relational algebra

扶醉桌前 提交于 2019-12-25 18:51:13
问题 I have seen that natural join is just combination of selection and cartesian product but in various websites its said to be as combination of projection and cartesian product and both are completely different so which definition should corresponds to it more exactly? 回答1: There are many different versions of "relational algebra" that differ even in their notion of "relation". There's no one PRODUCT or NATURAL JOIN. Some versions of the relational algebra have relation headings that are lists

Relational Algebra check for error

隐身守侯 提交于 2019-12-25 08:16:33
问题 Hi could someone please verify my work. Im not sure if im doing any of this correctly and would greatly appreciate any help. I am not allow to use the Bow tie operator. Thank you. Question: Books (ISBN, Title, Authors, Publisher, Ed, Year, Genre) Patron (MemberNumber, FirstName, LastName, AddressLn1, AddressLn2, City, State, Zipcode) Loan (MemberNumber,ISBN,DateLoaned,DateDue, DateReturned) Business Logic • You may assume that the library only has one copy of each book. • Each book may have

Using Relational Algebra, how can I find duplicate rows in a tuple?

不打扰是莪最后的温柔 提交于 2019-12-25 04:33:15
问题 I am completing a piece of homework and I'm really stuck and have been for a week. I'm not asking for the answer to the question, but just how I'd go about doing it. Basically I need to find duplicates in a single tuple. For example, if each entry was a user ID and a hobby, how would I find all entries where the user ID and hobby appear exactly the same at least two time? So if I had the following tuple... ID | Hobby ---------- 1 | Swimming 2 | Running 3 | Football 1 | Swimming 3 | Football 3

Is left join commutative? What are its properties?

风流意气都作罢 提交于 2019-12-24 22:55:42
问题 Assume tables TableA TableB TableC and TableD : Is the following query: TableA INNER JOIN TableB LEFT JOIN TableC LEFT JOIN TableD (all joined to an id column) equivalent to: TableA INNER JOIN TableB INNER JOIN TableC LEFT JOIN TableD UNION TableA INNER JOIN TableB LEFT JOIN TableC ON TableB.c_id IS NULL LEFT JOIN TableD ? Note: Or instead of union just do TableA INNER JOIN TableB INNER JOIN TableC LEFT JOIN TableD And then TableA INNER JOIN TableB LEFT JOIN TableC ON TableB.c_id IS NULL LEFT

Exist and Not Exists Query Misunderstanding?

感情迁移 提交于 2019-12-24 15:55:39
问题 Consider the following schema of a product database: Parts (pid, pname) Suppliers (sid, sname) Catalog (sid, pid) sid in Catalog is a foreign key and references Suppliers and pid in Catalog is a foreign key and references the Parts table. (s1, p1) in Catalog table shows supplier s1 produces p1 . If I want find details of Parts that are not supplied by some suppliers, how we can do this? I read some parts as follows: SELECT * FROM parts P WHERE ....... (SELECT S.sid FROM suppliers WHERE .....

Relational Algebra: Natural Join having the same result as Cartesian product

社会主义新天地 提交于 2019-12-24 09:57:46
问题 I am trying to understand what will be the result of performing a natural join between two relations R and S, where they have no common attributes. By following the below definition, I thought the answer might be an empty set: Natural Join definition. My line of thought was because the condition in the 'Select' symbol is not met, the projection of all of the attributes won't take place. When I asked my lecturer about this, he said that the output will be the same as doing a cartezian product

finding max value among two table without using max function in relational algebra

半世苍凉 提交于 2019-12-20 07:47:43
问题 Suppose I have two tables A{int m} and B{int m} and I have to find maximum m among two tables using relational algebra but I cannot use max function.How can I do it?I think using join we can do it but i am not sure if my guess is correct or not. Note: this is an interview question. 回答1: Hmm, I'm puzzled why the question involves two tables. For the question as asked, I would just UNION the two (as StilesCrisis has done), then solve for a single table. So: how to find the maximum m in a table

Join operators and commutativity

半腔热情 提交于 2019-12-20 05:56:15
问题 I am doing some relational algebra exercizes. On a teacher slide I saw a thing that makes me think that there can be an error. I think, the third JOIN, should be JOIN 'Farmacia' as F ON 'D'.'idCF' = 'F'.'idFì instead of JOIN 'Farmacia' as F ON 'F'.'idFì = 'D'.'idCF' Using this last command you will join Farmacia on itself, isn't it? The slide question says: Which pharmacy does sell drug X of phramaceutic company Y? 回答1: The order of the columns in the ON part of the statement doesn't