create table productinfotwo
(
productId number(10),
CONSTRAINT primary_pk Primary Key(productId),
productname varchar2(100),
SUBCATEGORYID number(10),
CONSTRAINT subcategory_fk Foreign Key(SUBCATEGORYID ) REFERENCES ProductSubCategory(SUBCATEGORYID ),
COMPANYID varchar2(20),
CONSTRAINT company_fk Foreign Key(COMPANYID ) References CompanyInfo(COMPANYID ),
price float,
quantity number(10),
description varchar2(1000),
);
Asked
Active
Viewed 114 times
-3

Srini V
- 11,045
- 14
- 66
- 89

Kashish Aneja
- 41
- 1
- 6
1 Answers
1
You need to have them in order
- Create ProductSubCategory table
- Create CompanyInfo table
- There is no datatype called float in Oracle. You can use NUMBER(4,2) instead
- Remove the comma after description
The code should be
CREATE TABLE productinfotwo
(
productid NUMBER(10),
CONSTRAINT primary_pk PRIMARY KEY(productid),
productname VARCHAR2(100),
subcategoryid NUMBER(10),
CONSTRAINT subcategory_fk FOREIGN KEY(subcategoryid ) REFERENCES
productsubcategory(subcategoryid ),
companyid VARCHAR2(20),
CONSTRAINT company_fk FOREIGN KEY(companyid ) REFERENCES companyinfo(
companyid ),
price NUMBER(4, 2),
quantity NUMBER(10),
description VARCHAR2(1000)
);

Srini V
- 11,045
- 14
- 66
- 89
-
1Good answer but I wouldn't recommend `number(4,2)` for a price. – Gordon Linoff Aug 22 '14 at 11:12
-
Yup, I agree its just to save him for time being. We never know what OP is upto – Srini V Aug 22 '14 at 11:25