Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using the BOOKSTORE database, write a query that finds the City of the store that has 3 3 books in stock. For your answer, only

Using the BOOKSTORE database, write a query that finds the City of the store that has 33 books in stock.
For your answer, only write the Cityin the answer without any commas or extra spaces. (i.e., xxxxx). Do not type your SQL query into the answer box.
For example, if the city is Townsville, write Townsville ONLY in the answer box,
this below is database
Page
3
of 3
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(11) NOT NULL,
`firstName` varchar(60) DEFAULT NULL,
`lastName` varchar(60) DEFAULT NULL,
PRIMARY KEY (`authorID`)
);
INSERT INTO `author` VALUES (1,'Sansa','Stark'),(2,'Stephen','King'),
(3,'Prakash','Bhandari'),(4,'Laurianne','Sitbon'),(5,'Sophie','Monk'),
(6,'George','Costanza'),(7,'Nikki','Peever'),(8,'Amanda','Jarvinen'),
(9,'Jake','Bradford'),(10,'Wayne','Wood'),(11,'Sam','Roy'),(12,'Ned','Stark');
# Table structure for table `publisher`
DROP TABLE IF EXISTS `publisher`;
CREATE TABLE `publisher`(
`publisherCode` int(11) NOT NULL,
`publisherName` varchar(60) NOT NULL,
`publisherCity` varchar(60) DEFAULT NULL,
`publisherState` enum('QLD','VIC','NSW','WA','TAS','NT','SA') NOT NULL,
PRIMARY KEY (`publisherCode`)
);
INSERT INTO `publisher` VALUES (1,'Publishing House','Perth','WA'),(2,'Storm Pty
Ltd','Melbourne','VIC'),(3,'Rooster House','Sydney','NSW'),(4,'Rainforest
Publishing','Hobart','TAS'),(5,'Cavill Press','Gold Coast','QLD'),(6,'South
Publishing','Adelaide','SA'),(7,'James Bond','Gold Coast','QLD');
# Table structure for table `branch`
DROP TABLE IF EXISTS `branch`;
CREATE TABLE `branch`(
`branchNumber` int(11) NOT NULL AUTO_INCREMENT,
`branchName` varchar(60) DEFAULT NULL,
`streetNo` varchar(15) DEFAULT NULL,
`streetName` varchar(30) DEFAULT NULL,
`branchCity` varchar(60) DEFAULT NULL,
`branchState` enum('QLD','VIC','NSW','WA','TAS','NT','SA') NOT NULL,
`numberEmployees` int(11) DEFAULT NULL,
PRIMARY KEY (`branchNumber`)
);
INSERT INTO `branch` VALUES (1,'QUT Bookstore','123','Fake
Street','Brisbane','QLD',5),(2,'Pick-a-book','Level 40,200','Martin
Place','Sydney','NSW',10),(3,'Paging all Readers','4300','Brunswick
Street','Melbourne','VIC',10),(4,'Books by the Ocean','20','Jane
Street','Hobart','TAS',3),(5,'Look Inna Book','600','Lake View','Darwin','NT',3),
(6,'Rad-elaide Books','100','North Street','Adelaide','SA',4),(7,'South Perth
Books','Level 4,500','Wilston Avenue','Perth','WA',7),(8,'Once Upon A
Bookstore','3A/700','The Strand Road','Townsville','QLD',8),(9,'Bookmark
Joe\'s','1','Red Road','Ayers Rock','NT',4),(10,'North Perth books','762','Western
Road','Perth','WA',3);
# Table structure for table `book`
DROP TABLE IF EXISTS `book`;
CREATE TABLE `book`(
`ISBN` char(13) NOT NULL,
`title` varchar(60) NOT NULL,
`publisherCode` int(11) NOT NULL,
`genre` enum('Non-Fiction','Science Fiction','Fantasy','Crime','Mystery','Young
Adult','Romance','General Fiction') DEFAULT NULL,
`retailPrice` decimal(6,2) DEFAULT NULL,
`paperback` enum('True','False') NOT NULL,
PRIMARY KEY (`ISBN`),
KEY `publisherCode`(`publisherCode`),
CONSTRAINT `publisherCode` FOREIGN KEY (`publisherCode`) REFERENCES `publisher`
(`publisherCode`)
);
INSERT INTO `book` VALUES ('0000000000001','True Crime',1,'Crime',54.95,'True'),
('0099886674850','The Neverending Story',1,'Fantasy',215.80,'False'),
('1234567890123','MySQL 101',1,'Non-Fiction',10.70,'True'),
('1236739872348','Teenage Mutant Ninja Turtles',5,'General Fiction',12.00,'False'),
('1265763422222','The Bachelorette',6,'Romance',1.50,'True'),('2847563928012','Game
of Thrones',2,'General Fiction',70.95,'True'),('3467802389345','A Clockwork
Orange',2,'General Fiction',80.75,'True'),
('4440987653789','Ghostrider',2,'Mystery',30.95,'True'),('4455667788990','Steven
Avery - guilty or innocent?',3,'Crime',50.00,'True'),('4568777220982','The
Habibs',4,'General Fiction',13.95,'True'),('6373242890234','American Horror
Story',2,'Non-Fiction',90.80,'False'),('6543780976790','Arrow',3,'Young
Adult',10.95,'True'),('9999999999999','Stranger Things 2',7,'Science
Fiction',100.50,'False');
# Table structure for table `inventory`
DROP TABLE IF EXISTS `inventory`;
CREATE TABLE `inventory`(
`ISBN` char(13) NOT NULL,
`branchNumber` int(11) NOT NULL,
`quantityInStock` int(11) DEFAULT '0',
PRIMARY KEY (`ISBN`,`branchNumber`),
CONSTRAINT `branchNumber` FOREIGN KEY (`branchNumber`) REFERENCES `branch`
(`branchNumber`),
CONSTRAINT `inventoryISBN` FOREIGN KEY (`ISBN`) REFERENCES `book`(`ISBN`)
);
INSERT INTO `inventory` VALUES ('0099886674850',1,1),('0099886674850',2,1),
('0099886674850',3,4),('0099886674850',4,3),('0099886674850',5,2),
('0099886674850',6,7),('0099886674850',7,3),('0099886674850',8,5),
('0099886674850',9,0),('0099886674850',10,0),('1234567890123

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions

Question

Define and Discuss Average and Marginal Tax rates

Answered: 1 week ago

Question

What do you think is likely to be Liams problem? Discuss.

Answered: 1 week ago

Question

What laws were passed because of domestic violence?

Answered: 1 week ago