38.6k views
2 votes
Which of the following queries contains a non-equality join?

A. SELECT title, authorid
FROM books, bookauthor
WHERE books.isbn = bookauthor.isbn
AND retail>20;
B. SELECT title, name
FROM books JOIN publisher
USING (pubid);
C. SELECT title, gift
FROM books, promotion
WHERE retail>=minretail
AND retail <= maxretail;
D. None of the above

User Meltuhamy
by
8.1k points

1 Answer

5 votes

Final answer:

The query containing a non-equality join is option C where books are joined with promotions based on a range of retail prices, using >= and <= as non-equality operators.

Step-by-step explanation:

The student has asked which of the queries contains a non-equality join. A non-equality join is one that uses operators other than equality (such as <, >, <=, >=) to join tables based on a specified condition. Going through the provided choices, the answer is C: SELECT title, gift FROM books, promotion WHERE retail>=minretail AND retail <= maxretail;. This particular query joins the books on promotions based on the retail price being within a certain range, using non-equality operators (>= and <=).

A non-equality join, also known as an inequality join, is a type of join where a condition other than equality is used to match rows between two tables. In the given queries, none of them contain a non-equality join. Option A uses an equality join, as it matches rows based on the equality condition of books.isbn = bookauthor.isbn. Option B uses the USING syntax, which performs an equality join on the common column pubid. Option C uses inequality conditions, but it does not involve joining two tables.

User LeftOnTheMoon
by
7.4k points