Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the BOOKSTORE database which of the following SQL queries perform the set operation cartesian product on the tables book and wrote? Group of answer
Using the BOOKSTORE database which of the following SQL queries perform the set operation cartesian product on the tables book and wrote?
Group of answer choices
SELECT FROM wrote LEFT JOIN book ON wrote.ISBN book.ISBN;
SELECT title, wrote.ISBN AS product FROM book RIGHT JOIN wrote ON book.ISBN wrote.ISBN;
SELECT FROM wrote CROSS JOIN book;
SELECT wrote.ISBN FROM wrote UNION SELECT book.ISBN FROM book;
Page
of
DROP DATABASE IF EXISTS bookstore;
CREATE DATABASE IF NOT EXISTS bookstore;
USE bookstore;
# Table structure for table author
DROP TABLE IF EXISTS author;
CREATE TABLE author
authorID int NOT NULL,
firstName varchar DEFAULT NULL,
lastName varchar DEFAULT NULL,
PRIMARY KEY authorID
;
INSERT INTO author VALUES 'Sansa','Stark''Stephen','King'
'Prakash','Bhandari''Laurianne','Sitbon''Sophie','Monk'
'George','Costanza''Nikki','Peever''Amanda','Jarvinen'
'Jake','Bradford''Wayne','Wood''Sam','Roy''Ned','Stark';
# Table structure for table publisher
DROP TABLE IF EXISTS publisher;
CREATE TABLE publisher
publisherCode int NOT NULL,
publisherName varchar NOT NULL,
publisherCity varchar DEFAULT NULL,
publisherState enumQLD'VIC',NSWWA'TAS',NTSA NOT NULL,
PRIMARY KEY publisherCode
;
INSERT INTO publisher VALUES 'Publishing House','Perth',WA'Storm Pty
Ltd'Melbourne','VIC''Rooster House','Sydney',NSW'Rainforest
Publishing','Hobart','TAS''Cavill Press','Gold Coast',QLD'South
Publishing','Adelaide',SA'James Bond','Gold Coast',QLD;
# Table structure for table branch
DROP TABLE IF EXISTS branch;
CREATE TABLE branch
branchNumber int NOT NULL AUTOINCREMENT,
branchName varchar DEFAULT NULL,
streetNo varchar DEFAULT NULL,
streetName varchar DEFAULT NULL,
branchCity varchar DEFAULT NULL,
branchState enumQLD'VIC',NSWWA'TAS',NTSA NOT NULL,
numberEmployees int DEFAULT NULL,
PRIMARY KEY branchNumber
;
INSERT INTO branch VALUES 'QUT Bookstore','Fake
Street','Brisbane',QLD'Pickabook','Level 'Martin
Place','Sydney',NSW'Paging all Readers','Brunswick
Street','Melbourne','VIC','Books by the Ocean','Jane
Street','Hobart','TAS','Look Inna Book','Lake View','Darwin',NT
'Radelaide Books','North Street','Adelaide',SA'South Perth
Books','Level 'Wilston Avenue','Perth',WA'Once Upon A
Bookstore',A'The Strand Road','Townsville',QLD'Bookmark
Joes'Red Road','Ayers Rock',NT'North Perth books','Western
Road','Perth',WA;
# Table structure for table book
DROP TABLE IF EXISTS book;
CREATE TABLE book
ISBN char NOT NULL,
title varchar NOT NULL,
publisherCode int NOT NULL,
genre enumNonFiction','Science Fiction','Fantasy','Crime','Mystery','Young
Adult','Romance','General Fiction' DEFAULT NULL,
retailPrice decimal DEFAULT NULL,
paperback enumTrue'False' NOT NULL,
PRIMARY KEY ISBN
KEY publisherCodepublisherCode
CONSTRAINT publisherCode FOREIGN KEY publisherCode REFERENCES publisher
publisherCode
;
INSERT INTO book VALUES 'True Crime','Crime','True'
'The Neverending Story','Fantasy','False'
MySQL 'NonFiction','True'
'Teenage Mutant Ninja Turtles','General Fiction','False'
'The Bachelorette','Romance','True''Game
of Thrones','General Fiction','True''A Clockwork
Orange','General Fiction','True'
'Ghostrider','Mystery','True''Steven
Avery guilty or innocent?'Crime','True''The
Habibs','General Fiction','True''American Horror
Story','NonFiction','False''Arrow','Young
Adult','True''Stranger Things 'Science
Fiction','False';
# Table structure for table inventory
DROP TABLE IF EXISTS inventory;
CREATE TABLE inventory
ISBN char NOT NULL,
branchNumber int NOT NULL,
quantityInStock int DEFAULT
PRIMARY KEY ISBNbranchNumber
CONSTRAINT branchNumber FOREIGN KEY branchNumber REFERENCES branch
branchNumber
CONSTRAINT inventoryISBN FOREIGN KEY ISBN REFERENCES bookISBN
;
INSERT INTO inventory VALUES
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started