Create the following table in your database with the following schema: Table: Products I Column Name 1 Туре 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 product_id I order_date | int I date | int unit +-- 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 | Leetcode Solutions | Jewels of Stringology | Book | HP | Lenovo | Leetcode Kit Вook 2 | Laptop | Laptop I T-shirt 5 Orders table: I product_id | order date | unit | 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 60 | 70 | 30 I 80 | 2 | 3 | 20 | 30 | 60 | 50 I 50 | 50 | 2 | 2 4

Oracle 12c: SQL
3rd Edition
ISBN:9781305251038
Author:Joan Casteel
Publisher:Joan Casteel
Chapter13: Views
Section: Chapter Questions
Problem 4MC
icon
Related questions
Question

code of create table and insert table only 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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps

Blurred answer
Knowledge Booster
Single Table
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
Oracle 12c: SQL
Oracle 12c: SQL
Computer Science
ISBN:
9781305251038
Author:
Joan Casteel
Publisher:
Cengage Learning
A Guide to SQL
A Guide to SQL
Computer Science
ISBN:
9781111527273
Author:
Philip J. Pratt
Publisher:
Course Technology Ptr
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781285196145
Author:
Steven, Steven Morris, Carlos Coronel, Carlos, Coronel, Carlos; Morris, Carlos Coronel and Steven Morris, Carlos Coronel; Steven Morris, Steven Morris; Carlos Coronel
Publisher:
Cengage Learning
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781305627482
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning