처음으로 많은 학대를 음탕 한 후 나는이 질문을 물었다. 진정되었다. 나는 다시 시도하고 있으며 더 구체적으로하려고 노력하고있다.SQL Oracle CREATE - 알 수없는 문제
나는 유니을위한 과제를 수행하고이 질문 중 하나에 대해 다음과 같은 메시지였다
Write Create Table SQL statements for the relational schema that you have created
Place the text in the specified location in the file: ASS1_SQL.TXT
• All tables must have primary keys.
• All tables must have appropriate foreign key constraints.
• Each foreign key column must have identical column name, datatype and size of the primary key
that it refers to
• Add any NOT NULL constraints as dictated by the ERD
• The following columns data types and sizes must be used
suppid, stkid number(2)
suppname, stkname varchar2(30)
sellprice, purchaseprice number(6,2)
이에 대한 내 대답했다 : 당신은 내가 가리키는 오전 말을하기 전에
CREATE Table SUPPLIER(
suppid Number(2) NOT NULL,
suppname varchar2(30),
stkid Number(2) NOT NULL,
citycode Number(2) NOT NULL,
Primary Key (suppid),
Foreign Key (citycode) references CITY
)
CREATE Table STOCKITEM(
stkid Number(2) NOT NULL,
stkname varchar2(30) ,
sellprice Number(6,2) ,
purchaseprice Number(6,2) ,
suppid Number(2) ,
Primary Key (stkid) ,
whid Number(2) NOT NULL,
suppid Number(2) Foreign Key references SUPPLIER ,
whid Number(4) Foreign Key references WAREHOUSE
)
내가 작성하지 않은 테이블 (및 내 질문에 표시)에 대해서는 이미 사용하고있는 데이터베이스에 WAREHOUSE
및 CITY
테이블이 생성되어 있다는 점에 유의하십시오.
이 코드는 테이블을 만들고 작동시킵니다. 그러나 10 점 만점에 0 점을 받았다. 위의 코드는 처음부터 약간 향상되었지만 NOT NULL 속성을 수정했습니다.
Do my NOT NULL and FOREIGN KEY Constraints seem to have the right syntax?
ERD를
은 아래로 나를 먼저 문의하고 나는 그것을 조정할 수 있습니다하십시오이 질문에 투표하기 전에 https://www.dropbox.com/sh/eohlj5h073kwp4u/Ot08kbdY7Q에서 PDF에서 찾을 수 있습니다. 그래서이 잘못 나에게 기회를주십시오
이 태그가 MySQL과 Oracle 모두에 태그가 지정되는 이유는 무엇입니까? 어떤 데이터베이스를 사용하고 있습니까? –
'Number()'타입은 오라클을 의미합니다 ... MySQL 태그를 제거하십시오 ... –
죄송합니다, 나는 SQL을 의미했습니다. 그게 더 좋은가요? –