Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Before starting these problems, update the JustLee Books database by executing the JLDB _ Build _ 9 . sql script, otherwise, your solutions might not

Before starting these problems, update the JustLee Books database by executing the JLDB_Build_9.sql script, otherwise, your solutions might not work!
Note: In this module, it is assumed that students already have JLDB installed so they need to run JLDB_Build_9.sql to add the three tables to the existing DB. If you do not have it installed, you need to run JLDB_Build_8.sql first and then JLDB_Build_9.sql.
Write a SQL code to join two tables using the WHERE statement. Explain what the query is intended to do in a complete, coherent sentence with no SQL terminology.
Repeat Problem 1 above but remove the WHERE statement. What happened? Why?
Write an SQL query to join three related tables using JOIN ... ON in the JustLee Books. Select four-five columns that you would like to display in the output (do not use SELECT *). Include one condition with a special comparison operator. Explain what the query is intended to do in a complete, coherent sentence with no SQL terminology.
Write an SQL query to join three related tables using JOIN ... USING in the JustLee Books. Select four-five columns that you would like to display in the output (do not use SELECT *). Include one condition with a special comparison operator and a logical operator. Do not use the same set of tables as before. Explain what the query is intended to do in a complete, coherent sentence with no SQL terminology.
Write an SQL query to join two tables using JOIN...ON and JOIN...USING (use SELECT *). Did you receive the same output? Why?
Write an SQL query that lists customers last name and first name if he/she does not have the same address and shipping street and whose orders include books that have the letter a in the title. In addition, consider only the following authors: Peterson, Adams, and Austin. Explain why some customers' names appear multiple times.
Write an SQL query to create a list of employees and their managers. Use columns aliases to clearly identify mangers and employees in the output.
Modify Problem 7 above to list all customers along with those who referred them (if any).
Write an SQL query to display a list of books in the BOOKS table. If a book has been ordered by a customer, also list the corresponding order number and the state in which the customer resides.
Use set operators UNION, INION ALL, INTERSECT, and MINUS to combine the results of two queries. Explain what queries are intended to do in complete, coherent sentences with no SQL terminology.
CREATE TABLE warehouses
(wh_id NUMBER(2),
location VARCHAR(12))
Statement 2
INSERT INTO warehouses
VALUES (10, 'Boston')
Statement 3
INSERT INTO warehouses
VALUES (20, 'Norfolk')
Statement 4
INSERT INTO warehouses
VALUES (30, 'San Diego')
Statement 5
COMMIT
Statement 6
Create Table Publisher2
(ID NUMBER(2),
Name VarCHAR2(23),
Contact VARCHAR2(15),
Phone VARCHAR2(12),
CONSTRAINT publisher2_pubid_pk PRIMARY KEY(id))
Statement 7
INSERT INTO PUBLISHER2
VALUES(1,'PRINTING IS US','TOMMIE SEYMOUR','000-714-8321')
Statement 8
INSERT INTO PUBLISHER2
VALUES(2,'PUBLISH OUR WAY','JANE TOMLIN','010-410-0010')
Statement 9
INSERT INTO PUBLISHER2
VALUES(3,'AMERICAN PUBLISHING','DAVID DAVIDSON','800-555-1211')
Statement 10
INSERT INTO PUBLISHER2
VALUES(4,'READING MATERIALS INC.','RENEE SMITH','800-555-9743')
Statement 11
INSERT INTO PUBLISHER2
VALUES(5,'REED-N-RITE','SEBASTIAN JONES','800-555-8284')
Statement 12
commit
Statement 13
Create Table Publisher3
(ID NUMBER(2),
Name VarCHAR2(23),
Contact VARCHAR2(15),
Phone VARCHAR2(12),
CONSTRAINT publisher3_pubid_pk PRIMARY KEY(id))
Statement 14
INSERT INTO PUBLISHER3
VALUES(2,'PUBLISH OUR WAY','JANE TOMLIN','010-410-0010')
Statement 15
INSERT INTO PUBLISHER3
VALUES(3,'AMERICAN PUB','DAVID DAVIDSON','800-555-1211')
Statement 16
INSERT INTO PUBLISHER3
VALUES(6,'PRINTING HERE','SAM HUNT','000-714-8321')
Statement 17
INSERT INTO PUBLISHER3
VALUES(7,'PRINT THERE','CINDY TIKE','010-410-0010')
Statement 18
commit
Statement 19
CREATE TABLE Employees (
EMPNO NUMBER(4),
LNAME VARCHAR2(20),
FNAME VARCHAR2(15),
JOB VARCHAR2(9),
HIREDATE DATE,
DEPTNO NUMBER(2) NOT NULL,
MTHSAL NUMBER(7,2),
MGR NUMBER(4),
CONSTRAINT employees_empno_PK PRIMARY KEY (EMPNO))
Statement 20
INSERT INTO employees VALUES (7839,'KING','BEN', 'GTECH2',TO_DATE('17-NOV-91','DD-MON-YY'),10,6000,NULL)
Statement 21
INSERT INTO employees VALUES (8888,'JONES','LARRY','MTech2',TO_DATE('17-NOV-98','DD-MON-YY'),10,4200,7839)
Statement 22
INSERT INTO employees VALUES (7344,'SMITH','SAM','GTech1',TO_DATE('17-NOV-95','DD-MON-YY'),20,4900,7839)
Statement 23
INSERT INTO employees VALUES (7355,'POTTS','JIM','GTech1',TO_DATE('17-NOV-95','DD-MON-YY'),20,4900,7839)
Statement 24
INSERT INTO employees VALUES (8844,'STUART','SUE','MTech1',TO_D

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

What is meant by Career Planning and development ?

Answered: 1 week ago

Question

What are Fringe Benefits ? List out some.

Answered: 1 week ago

Question

13.6 Explain how to set up aflexible benefits program.

Answered: 1 week ago

Question

13.2 Describe five government-mandated benefits.

Answered: 1 week ago