Database Systems: Design, Implementation, & Management
Database Systems: Design, Implementation, & Management
13th Edition
ISBN: 9781337627900
Author: Carlos Coronel, Steven Morris
Publisher: Cengage Learning
Question
Book Icon
Chapter 7, Problem 23RQ

(a)

Program Plan Intro

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;

Consider two tables:

Table creation:

CREATE TABLE VENDOR(VEND_CODE INT PRIMARY KEY);

CREATE TABLE PRODUCT(PROD_CODE VARCHAR(5), VEND_CODE INT,FOREIGN KEY (VEND_CODE) REFERENCES VENDOR (VEND_CODE));

Inserting values:

INSERT INTO VENDOR VALUES(123);

INSERT INTO VENDOR VALUES(124);

INSERT INTO VENDOR VALUES(125);

INSERT INTO VENDOR VALUES(126);

INSERT INTO PRODUCT VALUES('ABC', 125);

INSERT INTO PRODUCT VALUES('DEF', 124);

INSERT INTO PRODUCT VALUES('GHI', 124);

INSERT INTO PRODUCT VALUES('JKL', 123);

(b)

Program Plan Intro

UNION ALL set operator:

The UNION ALL set operator is used to combine the output of two or more than two queries and produce a result. The produced result contains duplicate values.

Syntax: QUERY UNION ALL QUERY;

Consider two tables:

Table creation:

CREATE TABLE VENDOR(VEND_CODE INT PRIMARY KEY);

CREATE TABLE PRODUCT(PROD_CODE VARCHAR(5), VEND_CODE INT,FOREIGN KEY (VEND_CODE) REFERENCES VENDOR (VEND_CODE));

Inserting values:

INSERT INTO VENDOR VALUES(123);

INSERT INTO VENDOR VALUES(124);

INSERT INTO VENDOR VALUES(125);

INSERT INTO VENDOR VALUES(126);

INSERT INTO PRODUCT VALUES('ABC', 125);

INSERT INTO PRODUCT VALUES('DEF', 124);

INSERT INTO PRODUCT VALUES('GHI', 124);

INSERT INTO PRODUCT VALUES('JKL', 123);

(c)

Program Plan Intro

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;

Consider two tables:

Table creation:

CREATE TABLE VENDOR(VEND_CODE INT PRIMARY KEY);

CREATE TABLE PRODUCT(PROD_CODE VARCHAR(5), VEND_CODE INT,FOREIGN KEY (VEND_CODE) REFERENCES VENDOR (VEND_CODE));

Inserting values:

INSERT INTO VENDOR VALUES(123);

INSERT INTO VENDOR VALUES(124);

INSERT INTO VENDOR VALUES(125);

INSERT INTO VENDOR VALUES(126);

INSERT INTO PRODUCT VALUES('ABC', 125);

INSERT INTO PRODUCT VALUES('DEF', 124);

INSERT INTO PRODUCT VALUES('GHI', 124);

INSERT INTO PRODUCT VALUES('JKL', 123);

(d)

Program Plan Intro

EXCEPT/ 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 EXCEPT QUERY;

Consider two tables:

Table creation:

CREATE TABLE VENDOR(VEND_CODE INT PRIMARY KEY);

CREATE TABLE PRODUCT(PROD_CODE VARCHAR(5), VEND_CODE INT,FOREIGN KEY (VEND_CODE) REFERENCES VENDOR (VEND_CODE));

Inserting values:

INSERT INTO VENDOR VALUES(123);

INSERT INTO VENDOR VALUES(124);

INSERT INTO VENDOR VALUES(125);

INSERT INTO VENDOR VALUES(126);

INSERT INTO PRODUCT VALUES('ABC', 125);

INSERT INTO PRODUCT VALUES('DEF', 124);

INSERT INTO PRODUCT VALUES('GHI', 124);

INSERT INTO PRODUCT VALUES('JKL', 123);

Blurred answer
Students have asked these similar questions
Convert the following table to third normal form (3NF). In this table, StudentNum determines StudentName, NumCredits, AdvisorNum, and AdvisorName. Advisor Num determines AdvisorName. CourseNum determines Description. The combination of StudentNum and CourseNum determines Grade. STUDENT (StudentNum, StudentName, NumCredits, AdvisorNum, AdvisorName, CourseNum, Description, Grade). Identify the primary key for the original table and the primary keys for the resulting tables. Indicate the foreign keys with italic font. Give meaning names to the resulting tables.
Suppose that the following are true:- all id column are primary keys in whichever table they are- the dept_id in course table is foreign key that is referencing the id column in the department table- the foreign keys stud_type_id, stud_cat_id in the student table are referencing the id columnsin the student_type and student_category tables respectively.- the coursecode and stud_id columns in the registration table are foreign keys in the courseand student tables respectively.1. Design an Entity Relationship Diagram for the system above.2. Write query that would return the names and contacts of all Local students.3. Write a query that would return names, contact and locations of all departments that has alocation text with Ave 3 as part of it. [hint: use the LIKE clause with “_” or “%”]4. What would be the result returned for the following query:SELECT first_name, last_name, student_type.name,student_category.nameFROM student, student_type, student_categoryWHERE stud_type_id =…
Answer the given question with a proper explanation and step-by-step solution.  c. Create a relastionship: You need to add a new column called DeptID in the Employee table, it will be the foreign key in this table, it should be text data type and 5 characters in length. Make sure you enter one of the corresponding departmentID's values (i.e., ECON, MIS, and BUS) for this column in the Employee table for this newly created DeptId column that you have entered in the Department table previously. Then, use the Relationships tool under Database Tools to create a relationship between the Department Table and the Employee table, i.e., connecting the two tables together via the primary key (DepartmentID in Department Table) and foreign key pair (DeptID in the Employee Table and choose Enforce Referential Integrity to set the integrity contraint between the foreign key and primary key

Chapter 7 Solutions

Database Systems: Design, Implementation, & Management

Ch. 7 - Prob. 11RQCh. 7 - Prob. 12RQCh. 7 - Prob. 13RQCh. 7 - Prob. 14RQCh. 7 - Prob. 15RQCh. 7 - What does it mean to say that SQL operators are...Ch. 7 - Prob. 17RQCh. 7 - Prob. 18RQCh. 7 - Prob. 19RQCh. 7 - Prob. 20RQCh. 7 - Given the employee information in Question 19,...Ch. 7 - Given the employee information in Question 19,...Ch. 7 - Prob. 23RQCh. 7 - Prob. 24RQCh. 7 - Prob. 25RQCh. 7 - What Oracle function should you use to calculate...Ch. 7 - What string function should you use to list the...Ch. 7 - Prob. 28RQCh. 7 - Given the structure and contents of the...Ch. 7 - Using the EMPLOYEE, JOB, and PROJECT tables in the...Ch. 7 - Write the SQL code that will produce the same...Ch. 7 - Prob. 4PCh. 7 - Write the SQL code to validate the ASSIGN_CHARGE...Ch. 7 - Using the data in the ASSIGNMENT table, write the...Ch. 7 - Prob. 7PCh. 7 - Prob. 8PCh. 7 - Prob. 9PCh. 7 - Prob. 10PCh. 7 - Generate a listing of all purchases made by the...Ch. 7 - Prob. 12PCh. 7 - Prob. 13PCh. 7 - Modify the query in Problem 13 to include the...Ch. 7 - Prob. 15PCh. 7 - Prob. 16PCh. 7 - Prob. 17PCh. 7 - Prob. 18PCh. 7 - Prob. 19PCh. 7 - Prob. 20PCh. 7 - Prob. 21PCh. 7 - Create a query to find the balance characteristics...Ch. 7 - Prob. 23PCh. 7 - Prob. 24PCh. 7 - Prob. 25PCh. 7 - Find the total value of the product inventory. The...Ch. 7 - Prob. 27PCh. 7 - Write a query to display the SKU (stock keeping...Ch. 7 - Prob. 29PCh. 7 - Prob. 30PCh. 7 - Prob. 31PCh. 7 - Prob. 32PCh. 7 - Prob. 33PCh. 7 - Prob. 34PCh. 7 - Prob. 35PCh. 7 - Prob. 36PCh. 7 - Prob. 37PCh. 7 - Prob. 38PCh. 7 - Prob. 39PCh. 7 - Prob. 40PCh. 7 - Prob. 41PCh. 7 - Prob. 42PCh. 7 - Prob. 43PCh. 7 - Prob. 44PCh. 7 - Prob. 45PCh. 7 - Prob. 46PCh. 7 - Prob. 47PCh. 7 - Prob. 48PCh. 7 - Prob. 49PCh. 7 - Prob. 50PCh. 7 - Prob. 51PCh. 7 - Prob. 52PCh. 7 - Prob. 53PCh. 7 - Prob. 54PCh. 7 - Prob. 55PCh. 7 - Prob. 56PCh. 7 - Prob. 57PCh. 7 - Prob. 58PCh. 7 - Prob. 59PCh. 7 - Prob. 60PCh. 7 - Prob. 61PCh. 7 - Prob. 62PCh. 7 - Prob. 63PCh. 7 - Prob. 64PCh. 7 - Prob. 65PCh. 7 - Prob. 66PCh. 7 - Prob. 67PCh. 7 - Prob. 68PCh. 7 - Prob. 69PCh. 7 - Prob. 70PCh. 7 - Prob. 71PCh. 7 - Prob. 72PCh. 7 - Prob. 73PCh. 7 - Prob. 74PCh. 7 - Prob. 75PCh. 7 - Prob. 76PCh. 7 - Prob. 77PCh. 7 - Prob. 78PCh. 7 - Prob. 79PCh. 7 - Prob. 80PCh. 7 - Prob. 81PCh. 7 - Prob. 82PCh. 7 - Prob. 83PCh. 7 - Prob. 84PCh. 7 - Prob. 85PCh. 7 - Prob. 86PCh. 7 - Prob. 88PCh. 7 - Prob. 89PCh. 7 - Prob. 90PCh. 7 - Prob. 91PCh. 7 - Prob. 92PCh. 7 - Prob. 93PCh. 7 - Prob. 94PCh. 7 - Prob. 95PCh. 7 - Prob. 96PCh. 7 - Prob. 97PCh. 7 - Prob. 98PCh. 7 - Prob. 99PCh. 7 - Prob. 100PCh. 7 - Prob. 101PCh. 7 - Prob. 102PCh. 7 - Prob. 103PCh. 7 - Prob. 104PCh. 7 - Prob. 105PCh. 7 - Prob. 106PCh. 7 - Prob. 107PCh. 7 - Prob. 108PCh. 7 - Prob. 109P
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781305627482
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781285196145
Author:Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:Cengage Learning