初めて多くの虐待に対処した後、私はこの質問をしましたが、落ち着いて、もう一度やり直して、より具体的にしようとしています.
私は Uni の割り当てを行いましたが、これは質問の 1 つに対する次のプロンプトでした。
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 にあります。
この質問に投票する前に、まず私に相談してください。調整できます。私はこのウェブサイトを初めて使用するので、機会をください