Table name: Supplier Column Name Role Data Type Length Constraint supplierID Stores the ID of a supplier Number 10 Primary key supplierFName Stores the first name of a supplier Varchar2 30 Cannot be null supplierLName Stores the last Name of a supplier Varchar2 30 Cannot be null supplierDOB Stores the date of birth of a supplier Date - supplierNBPro Stores the number of products supplied by a supplier Number 3 Should be greater than 10 a. Write in SQL a statement that adds a new column named comapnyID of type char(5). This column should be defined as a foreign key that relates the table Supplier to the table Company b. Write in SQL a query that displays the ids of the suppliers who supply the highest number of products. c. Create a view named ‘SupplierDetails’ to hold all the details of suppliers whose last names start with ‘bait’ and who supply between 50 and 200 products.
Table name: Supplier |
||||
Column Name |
Role |
Data Type |
Length |
Constraint |
supplierID |
Stores the ID of a supplier |
Number |
10 |
Primary key |
supplierFName |
Stores the first name of a supplier |
Varchar2 |
30 |
Cannot be null |
supplierLName |
Stores the last Name of a supplier |
Varchar2 |
30 |
Cannot be null |
supplierDOB |
Stores the date of birth of a supplier |
Date |
- |
|
supplierNBPro |
Stores the number of products supplied by a supplier |
Number |
3 |
Should be greater than 10 |
a. Write in SQL a statement that adds a new column named comapnyID of type char(5). This column should be defined as a foreign key that relates the table Supplier to the table Company
b. Write in SQL a query that displays the ids of the suppliers who supply the highest number of products.
c. Create a view named ‘SupplierDetails’ to hold all the details of suppliers whose last names start with ‘bait’ and who supply between 50 and 200 products.
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 3 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)