I want to achieve this in sql The item condition could be New, Refurbished, or E
ID: 3818469 • Letter: I
Question
I want to achieve this in sql
The item condition could be New, Refurbished, or Explained. If the condition of an item is set to Explained, the seller should explain about the item condition in the item description?
Do i have to create a condition table or use something else?
my item table looks like that:
create table item
(
itemID char(5) NOT NULL,
itemName varchar(15) NOT NULL,
desciption varchar(25),
initialPrice decimal(8,2),
quantity int,
ownerName varchar(20),
PRIMARY KEY (itemID));
Explanation / Answer
There are 2 solutions for it :-
1.Either add a new column condition varchar(20) Not null in item table
2. create a new table condition as item id to be foreign key mapped from item table like
create table condition
(
condition_itemID char(5) NOT NULL,
condition varchar(20) NOT NULL,
Foreign Key(condition_itemID) REFERENCES item(itemID)
);
if you need anything else let us know.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.