Create the following table in your database with the following schema: Table: Products Column Name 1 Туре I product_id I product_name I product_category | varchar | | int | varchar | +- ----+ product_id is the primary key for this table. This table contains data about the company's products. Table: Orders | Column Name 1 Туре +---- I product_id order_date I unit | int I date I int +---- +---------+ There is no primary key for this table. It may have duplicate rows. product_id is a foreign key to the Products table. unit is the number of products ordered in order_date. Add the following data to your tables: Input: Products table: +-- I product_id I product_name I product_category | | Leetcode Solutions 1 Воok | Jewels of Stringology Book | Laptop | Laptop | T-shirt 1 | 2 | HP 4 Lenovo | 5 | Leetcode Kit

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write the full sql query including (create,insert,select...) please

Create the following table in your database with the following schema:
Table: Products
| Column Name
Type
+-
I product_id
I product name
I product_ category | varchar
| int
varchar
+----
-----+---------+
product_id is the primary key for this table.
This table contains data about the company's products.
Table: Orders
| Column Name
| Type
I product id
I order date
| unit
| int
I date
| int
+----
+--
There is no primary key for this table. It may have duplicate rows.
product_id is a foreign key to the Products table.
unit is the number of products ordered in order date.
Add the following data to your tables:
Input:
Products table:
+--
I product id
I product name
I product_category I
| 1
| 2
| 3
| 4
| 5
| Leetcode Solutions
| Jewels of Stringology | Book
| HP
| Lenovo
| Leetcode Kit
Book
| Laptop
| Laptop
I T-shirt
Orders table:
+-----
I product id
| order date
I unit
+
| 1
| 1
| 2
| 2
| 3
| 3
| 60
| 70
| 30
| 80
| 2
| 3
| 20
| 30
| 60
| 50
| 50
| 50
2020-02-05
| 2020-02-10
| 2020-01-18
| 2020-02-11
| 2020-02-17
| 2020-02-24
| 2020-03-01
| 2020-03-04
| 2020-03-04
| 2020-02-25
| 2020-02-27
| 2020-03-01
| 5
| 5
| 5
Transcribed Image Text:Create the following table in your database with the following schema: Table: Products | Column Name Type +- I product_id I product name I product_ category | varchar | int varchar +---- -----+---------+ product_id is the primary key for this table. This table contains data about the company's products. Table: Orders | Column Name | Type I product id I order date | unit | int I date | int +---- +-- There is no primary key for this table. It may have duplicate rows. product_id is a foreign key to the Products table. unit is the number of products ordered in order date. Add the following data to your tables: Input: Products table: +-- I product id I product name I product_category I | 1 | 2 | 3 | 4 | 5 | Leetcode Solutions | Jewels of Stringology | Book | HP | Lenovo | Leetcode Kit Book | Laptop | Laptop I T-shirt Orders table: +----- I product id | order date I unit + | 1 | 1 | 2 | 2 | 3 | 3 | 60 | 70 | 30 | 80 | 2 | 3 | 20 | 30 | 60 | 50 | 50 | 50 2020-02-05 | 2020-02-10 | 2020-01-18 | 2020-02-11 | 2020-02-17 | 2020-02-24 | 2020-03-01 | 2020-03-04 | 2020-03-04 | 2020-02-25 | 2020-02-27 | 2020-03-01 | 5 | 5 | 5
Write an SQL query to get the names of products that have at least 100 units ordered in February 2020
and their amount.
Return result table in any order.
The results should be:
Output:
+-
I product name
| unit
+--
| Leetcode Solutions | 130
| Leetcode Kit
| 100
Explanation:
Products with product id = 1 is ordered in February a total of (60 + 70) = 130.
Products with product id = 2 is ordered in February a total of 80.
Products with product id = 3 is ordered in February a total of (2 + 3)
Products with product id = 4 was not ordered in February 2020.
Products with product id
= 5.
= 5 is ordered in February a total of (50 + 50)
= 100.
Transcribed Image Text:Write an SQL query to get the names of products that have at least 100 units ordered in February 2020 and their amount. Return result table in any order. The results should be: Output: +- I product name | unit +-- | Leetcode Solutions | 130 | Leetcode Kit | 100 Explanation: Products with product id = 1 is ordered in February a total of (60 + 70) = 130. Products with product id = 2 is ordered in February a total of 80. Products with product id = 3 is ordered in February a total of (2 + 3) Products with product id = 4 was not ordered in February 2020. Products with product id = 5. = 5 is ordered in February a total of (50 + 50) = 100.
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY