1.- All products(items) in the shop catalog; product code, name and price 2.- Products sold in the shop; product code, name and price and full name of buyer. 3.- Products in stock (not sold); product code, name and price

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Given the relational database shop defined in the script below;
create database shop;
use shop;
create table users(
   id int null auto_increment,
   firstname varchar(255),
   lastname varchar(255) not null,
   primary key (id)
);
create table items(
  id int null auto_increment,
  name varchar(255),
  price float,
  primary key (id)
);
create table orders(
   id int null auto_increment,
   id_users int not null,
   id_items int not null,
   primary key (id),
   foreign key (id_users) references users(id),
   foreign key (id_items) references items(id)
);
 
write three SQL queries to answer the following questions
1.- All products(items) in the shop catalog; product code, name and price
2.- Products sold in the shop; product code, name and price and full name of buyer.
3.- Products in stock (not sold); product code, name and price
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Can you help me with this code? I need PK and Foreign key

ABC Company is a special online retail company that sells certain products to its customers. Products belong to three categories (technology, office supply and furniture). A customer can order multiple products from these
categories. When a customer places an order, a company sales representative will be assigned to process the order. Customer name, date of order, product(s) and the price(s) must be recorded. The following are the data for a
two-month period that need to be stored in the database:
Customers:
Last Name
Smith
Boden
Price
Burton
Wang
Products:
Product Name
3D Printer
X-Chair
Design Box
SonfiTalk
SonTour Desk
ArtBox
SonTour Chair
Recorded Orders:
Last Name
Smith
Price
Wang
Wang
Burton
Employees:
Last Name
Cuban
Gonzalez
Gonzalez
LU
Davis
First Name
Alex
Paul
Mary
Jane
Jeff
First Name
Alex
Mary
Jeff
Jeff
Jane
First Name
Mark
Roger
Dave
April
Sandy
Address
2 South ST
21 North St
Apt 3, 11th Ave
7 Maple Ave
20 Northern BLVD
Category
Technology
Furniture
Supply
Technology
Furniture
Supply
Furniture
Item
3D Printer
ArtBox
Design Box
ConTour, Chair
SonTour Desk
ConTour Chair
Hire Date
2018-11-20
2015-02-19
2017-06-30
2017-08-20
2019-02-12
Price
765.78
234.59
23.12
235.99
278.89
16.67
189.89
Y
N
Y
Y
Y
1
2
Quantity
3
1
1
1
Current
City
Newark
Bergen
NY
Tampa
LA
State
NJ
NJ
NY
FL
CA
Price
765.78
16.67
19.99
189.89
278.89
189.89
Salary
54555.78
45000.56
65332.77
58784.34
50020.45
Quantity
12
17
200
27
45
123
29
ZIP
07104
07047
10074
33605
90006
Age
27
38
45
37
34
Sale Time
2022-02-22
2022-03-17
2022-03-25
2022-03-21
2022-02-27
Tel
9174251243
9083421987
2128137658
8132341956
2134314356
Received
2020-01-23
2020-01-20
2020-02-12
2020-03-01
2020-03-12
2020-03-18
2020-02-15
Sale Rep
Mark
Sandy
Sandy
Mark
April
Manager
April
April
Dave
April
Transcribed Image Text:ABC Company is a special online retail company that sells certain products to its customers. Products belong to three categories (technology, office supply and furniture). A customer can order multiple products from these categories. When a customer places an order, a company sales representative will be assigned to process the order. Customer name, date of order, product(s) and the price(s) must be recorded. The following are the data for a two-month period that need to be stored in the database: Customers: Last Name Smith Boden Price Burton Wang Products: Product Name 3D Printer X-Chair Design Box SonfiTalk SonTour Desk ArtBox SonTour Chair Recorded Orders: Last Name Smith Price Wang Wang Burton Employees: Last Name Cuban Gonzalez Gonzalez LU Davis First Name Alex Paul Mary Jane Jeff First Name Alex Mary Jeff Jeff Jane First Name Mark Roger Dave April Sandy Address 2 South ST 21 North St Apt 3, 11th Ave 7 Maple Ave 20 Northern BLVD Category Technology Furniture Supply Technology Furniture Supply Furniture Item 3D Printer ArtBox Design Box ConTour, Chair SonTour Desk ConTour Chair Hire Date 2018-11-20 2015-02-19 2017-06-30 2017-08-20 2019-02-12 Price 765.78 234.59 23.12 235.99 278.89 16.67 189.89 Y N Y Y Y 1 2 Quantity 3 1 1 1 Current City Newark Bergen NY Tampa LA State NJ NJ NY FL CA Price 765.78 16.67 19.99 189.89 278.89 189.89 Salary 54555.78 45000.56 65332.77 58784.34 50020.45 Quantity 12 17 200 27 45 123 29 ZIP 07104 07047 10074 33605 90006 Age 27 38 45 37 34 Sale Time 2022-02-22 2022-03-17 2022-03-25 2022-03-21 2022-02-27 Tel 9174251243 9083421987 2128137658 8132341956 2134314356 Received 2020-01-23 2020-01-20 2020-02-12 2020-03-01 2020-03-12 2020-03-18 2020-02-15 Sale Rep Mark Sandy Sandy Mark April Manager April April Dave April
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Web Page
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education