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_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_forwardI 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_forward
- Consider 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_forwardA 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_forward
- PLZ 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_forward1. Create a PL/SQL function. The minimal requirements: using the cursor in PLSQL function, retrieve data from object table and record the data in the PL/SQL table, make calculations with object data and define return value of the function, test the operation of the function (get the result). The maximal requirements: you can add IF-ELSEIF's, cursor processing in loops, more interesting semantic functions. 2. Create methods for object types. The minimal requirements: use map/order methods (1 method) (method+ demonstration), use MEMBER methods (2 methods) (methods + demonstration). The maximal requirements: non-trivial methods, that use more complex comparisons or do more complex calculations – i.e., give a couple more constructs in code. 3. Demonstrate the multiset operators. The minimal requirements: using 2 different multiset operators (can be included in the code), they can also be used in the The maximal requirements: the queries make sense semantically, one of the queries is a…arrow_forward
- The aim of assignment 1 is to implement a database schema and execute different types of SQL queries in Oracle SQL developer. Given the following relational schema: Student (studid, FirstName, LastName, Email, phoneNumber, DateofBirth, GPA) Club (clubid, ClubName, #studid) MemberOf (#clubid, #studid, joiningDate ) Activities (actid, actdt, place, durationNbHour) Organize (#actid , #clubid , fee) 1. Write SQL queries to create the following tables according to the below descriptions. Table name: Student studid |Char(9) Primary key FirstName Varchar2(50) NOT NULL LastName Varchar2(50) NOT NULL Email Varchar2(50) NOT NULL, UNIQUE phoneNumber Number(8) NOT NULL, UNIQUE DateofBirth Date NOT NULL GPA Number(1,2) NOT NULL Table name: Club clubID Number(3) Primary key ClubName Varchar2(20)NOT NULL NULL, UNIQUE, NOT Foreign key studid Char(9) Table Name: MemberOf ClubID Number(3) Primary Key, Foreign Key Studid Char(9) Primary Key, Foreign Key joiningDate Date Table Name: Activities Actid…arrow_forwardWhat is the difference between scalar function and vector function in SQL DATABASE? Note: Question is based on SQL DATABASE.arrow_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_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