UNION set operator:
The UNION set operator is used to combine the output of two or more than two queries and produce a result. The produced result contains unique values.
Syntax: QUERY UNION QUERY;
INTERSECT set operator:
The INTERSECT set operator is used to combine the output of two or more than two queries and produce a result. The produced result contains the values (rows) that are common in both the tables.
Syntax: QUERY INTERSECT QUERY;
MINUS set operator:
The MINUS set operator is used to combine the output of two or more than two queries and produce a result. The produced result contains the values (rows) that appear in the first table but not in the second table. The word “EXCEPT” can also be used in the place of “MINUS”.
Syntax: QUERY MINUS QUERY;
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Database Systems: Design, Implementation, & Management
- The following SQL queries use the instances of R1 of "Reserves" the instances of B1 of "Boats", and the instances of S1 of "Sailors" relation. An instance R1 of Reserves bid 101 103 103 day 10/10/96 11/12/96 10/11/96 12/01/96 12/05/96 10/10/09 10/10/98 104 10/07/98 11/10/98 09/08/98 09/05/98 09/08/98 SIC 22 22 31 31 22 22 31 64 64 74 103 102 104 102 101 102 103 An instance B1 of Boats bid 101 102 103 bname Interlake Interlake Clipper Marine 104 bcolor blue red green red An instance S2 of Sailors SIG 28 31 21 44 26 58 22 22 29 29 22 32 2 64 21 74 85 95 71 sname yuppy Tubber guppy rusty Dustin Brutus Andy Horte Horatio Zorba Art Bob Amy rating 81 5 10 11 1 & |10|| El 3 115 age 35 155 135 135 45 33 25 135 18 25 635 46 1.If we wish to list out only the names and ratings of the sailors, we can write this in SQL statement as 2.Find out only the names and ages of sailors. 3.To find out the names and ratings of sailors with a rating above 8, we can combine two of the preceding queries as:…arrow_forwardCan someone help me with this? Please use relational algebra.arrow_forwardFor each of the following pairs of expressions, give instances of relations thatshow the expressions are not equivalent. In the preceding expressions, if both occurrences of max were replaced by min, would the expressions be equivalent?arrow_forward
- I have created the DDL below: I am getting an error about an existing constraint with the borrower_fkey for the borrower relation. At the same time, I feel like I have not satisfied all the requirements. Could someone show me what I did wrong? The class is being taught using PostgreSQL so the changes have to be applicable to postgreSQL. Thank you! CREATE TABLE branch (branch_name varchar(25) NOT NULL,branch_city varchar(15),assets numeric(15,2),CONSTRAINT branch_pkey PRIMARY KEY (branch_name));CREATE TABLE customer (ID varchar(10),customer_name varchar(25) NOT NULL,customer_street varchar(25) NOT NULL,customer_city varchar(15) NOT NULL,CONSTRAINT customer_pkey PRIMARY KEY (ID));CREATE TABLE loan (loan_number varchar(25) NOT NULL,branch_name varchar(25) NOT NULL,amount numeric(25,2) NOT NULL,CONSTRAINT loan_pkey PRIMARY KEY (loan_number),CONSTRAINT loan_fkey FOREIGN KEY (branch_name) REFERENCES branch (branch_name) ON DELETE CASCADE); CREATE TABLE borrower (ID varchar(25),loan_number…arrow_forwardConsider the following expressions, which use the result of a relational algebra operation as the input to another operation. For each expression, explain in words what the expression does. a. year 2009 (takes) ▷ student b. year 2009 (takes ▷ student) C. ID.name, course_id (student takes)arrow_forwardFor each of the following pairs of expressions, give instances of relations thatshow the expressions are not equivalent. ΠA(r − s) and ΠA(r) − ΠA(s).arrow_forward
- A phone company has set up the following database in order to be able to send detailed bills to its customers: CUSTOMER(Phone#,FirstName, LastName, City), CALL(CallerPhone#, CalledPhone#, Date, Time, Duration, Cost), The keys of the relations are underlined. Answer must be written in relational algebra On which days did all the customers make at least one call? Is there a way to write this in relational algebra without using count? Subject: MYSQLarrow_forwardPLZ help with the following: IN SQL Let R (A, B, C) be a relation schema. What happens if we execute the following query? SELECT* FROM R WHERE A=D; Select one: a. We get an error. b. The query executes successfully but returns no tuples. c. The query returns all the tuples in R.arrow_forwardI want to check to see if what I have is correct and if not please be detailed in your explanation as to why. Thank You!arrow_forward
- The course I'm taking is database management. I need help with part A and B please. I am using APEX Oracle compiler. I have attached the employee table. Part A - Implement a procedure in PL/SQL to check if employee is eligible to a salaryincrement depending on his period of service. If he had served for 6 months ormore he is eligible for an increment. Use an if-else statement and print if he iseligible for increment or not . Hint: add_months(hiredate, 6) function will give you the date after 6 months ofhiredate.sysdate is used in oracle instead of the curdate() function in SQL to get the currentdate. Part B - Write a procedure to add 2 numbers and display the resultarrow_forwardPlease written by computer source The following relation is an extract from a restaurant point-of-sale (POS) system. The system assigns a globally unique id (GUID) to every transaction processed. CheckID comes from the pre-printed check number on the ticket used by the server for the order; these pre-printed tickets are guaranteed to be unique within the restaurant. RegisterID is which register was used for checkout and the date and time of the checkout – to the minute – are recorded in CheckoutDT; assume no two checkouts can occur at the same register in the same minute. PayType and PayTotal are, respectively, how the check was paid and what the total payment was; assume there is no splitting of a check among multiple payments. When answering the questions below use the format [attribute, attribute, …, attribute] to identify keys. 1. How many keys in general (including the empty or null key) are there in this relation? 2. Identity two multi-keys for this relation. 3. Identify two…arrow_forwardWrite the following queries, based on the database schema Product(maker, model, type)PC(model, speed, ram, hd, price)Laptop(model, speed, ram, hd, screen, price)Printer(model, color, type, price) of Exercise 2.4.1. You should use at least one subquery in each of your answersand write each query in two significantly different ways (e.g., using differentsets of the operators EXISTS, IN, ALL, and ANY). a) Find the makers of PC's with a speed of at least 3.0.b) Find the printers with the highest price.! c) Find the laptops whose speed is slower than that of any PC.! d) Find the model number of the item (PC, laptop, or printer) with thehighest price.! e) Find the maker of the color printer with the lowest price.!! f) Find the maker(s) of the PC(s) with the fastest processor among all thosePC's that have the smallest amount of RAM.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education