Questions tagged [minus]

For questions involving the MINUS operator, which is the Oracle’s dialect counterpart of the SQL standard’s EXCEPT. Both MINUS and EXCEPT are based on the set operator called DIFFERENCE in relational algebra.

Filter by
Sorted by
Tagged with
1
vote
3answers
233 views

How to select students that failed at least at all courses that student with id = 1 failed?

I have the following tables: STUDENT (student_id, first_name, last_name, birth_date, year , domain) PROFESSOR (professor_id, first_name, last_name, birth_date, hire_date, title, salary) COURSE (...
0
votes
2answers
153 views

Select items that have never been ordered using the MINUS operator

I have the following two tables: ITEM (Item#, Item_Name, Unit_Price) ORDER_ITEM (Order#, Item#, Qty) Now, how do I list the items that have never been ordered by using the MINUS operator?
3
votes
2answers
214 views

UNION ALL w/ MINUS

Why does: select 1 FROM DUAL UNION ALL select 1 FROM DUAL MINUS SELECT 2 FROM DUAL return only a single 1 rather than 2 rows of 1 in Oracle?
1
vote
2answers
4k views

Oracle: finding rows without children in a table with a foreign key?

Suppose I have two tables with a foreign key relationship. How can I find the rows in the "parent" table for which there is no corresponding "child" row? For example: create table a(x number ...
0
votes
1answer
3k views

ORA-00907: missing right parenthesis on query with subqueries and EXCEPT operator

I am getting ORA-00907: missing right parenthesis for the following query: SELECT PEOPLE.NAME FROM CLIENTS K INNER JOIN PEOPLE ON K.ID_L = PEOPLE.ID_L WHERE NOT EXISTS ( (SELECT DISTINCT ARTIST....
0
votes
2answers
748 views

CASE Statement - 1st case is being ignored

I have a table (usr_t_user_reg) in which I register all the users of the database. Now I want to create a view (usr_v_user_not_reg) which shows me all the users that I haven't registered yet or users ...
1
vote
1answer
1k views

Oracle Alternative to EXISTS EXCEPT

I wonder if there is an equally elegant solution for Oracle for the problem posted and answered here: Comparing Columns that can contain NULLS - is there a more elegant way? I can't get this ...
6
votes
4answers
2k views

Optimizing a compare query

Suppose I have two tables, A and B, and I know that size(A) = size(B). I want to confirm that the data in both tables is the same in three given columns, suppose they are X, Y, and Z (there are no ...
5
votes
3answers
2k views

Database replication and consistency check

I got a question about two databases (in Oracle 10g) that I have, let's call them A and B. A have some information (in various tables) and I want B to get a partial copy of some tables from A, and ...