a Write in SQL a command that creates the table Products according to the above description a. Write in SQL a statement that adds to the table Products a new columm named supplierID of type Number(5). This column should be defined as a foreign key that relates the table Products to the table Supplier c. Write in SQL a query that lists all the details of products arranged in descending order according to the entry date

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
icon
Concept explainers
Question
1. Use the following table to answer the questions below:
Table name: Products
Column
Role
Data Type Length
Constraint
Name
Stores the ID of a product
Stores the name of a
product
P_entryDate Stores the entry date of a
| product
Stores the expiry date of a
product
P_ID
P_Name
Number
Varchar2
|Primary key
25
Date
Cannot be null
P_Expiry
Date
P_Expiry date
should be greater
than P_entryDate
|Cannot be null
P_Price
| Stores the price of a product | Number
3,2
2.
a. Write in SQL a command that creates the table Products according to the above description
b. Write in SQL a statement that adds to the table Products a new column named supplierlD of type Number(5).
This column should be defined as a foreign key that relates the table Products to the table Supplier
c. Write in SQL a query that lists all the details of products arranged in descending order according to the entry
date
a. Write a SQL query that displays the number of products that will expire in the year 2021|
e. Write in SQL a query that displays the ids of the most expensive products |
f. Create a view named 'ProductDetails' to hold all the details of products whose names start with 'DELL' and
their prices are between 200 and 500 Omani Rials
Transcribed Image Text:1. Use the following table to answer the questions below: Table name: Products Column Role Data Type Length Constraint Name Stores the ID of a product Stores the name of a product P_entryDate Stores the entry date of a | product Stores the expiry date of a product P_ID P_Name Number Varchar2 |Primary key 25 Date Cannot be null P_Expiry Date P_Expiry date should be greater than P_entryDate |Cannot be null P_Price | Stores the price of a product | Number 3,2 2. a. Write in SQL a command that creates the table Products according to the above description b. Write in SQL a statement that adds to the table Products a new column named supplierlD of type Number(5). This column should be defined as a foreign key that relates the table Products to the table Supplier c. Write in SQL a query that lists all the details of products arranged in descending order according to the entry date a. Write a SQL query that displays the number of products that will expire in the year 2021| e. Write in SQL a query that displays the ids of the most expensive products | f. Create a view named 'ProductDetails' to hold all the details of products whose names start with 'DELL' and their prices are between 200 and 500 Omani Rials
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Query Syntax
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