Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
423 views
in Technique[技术] by (71.8m points)

sql - Oracle alter table使团队可以支持多个慈善团体(如果他们希望更改数据库以满足此要求)(Oracle alter table to allow a team to support several charities if they wish change the database to satisfy this requirement)

Hi i need help with the following question:

(嗨,我需要以下问题的帮助:)

Following requests from several teams, Run Monash would like to allow a team to support several charities if they wish.

(根据几个团队的要求,Run Monash希望允许一个团队支持一些慈善机构。)

Where a team does support several charities they must nominate, one charity as their prime charity, the one they will provide the main support to.

(如果一个团队确实支持几个他们必须提名的慈善机构,其中一个慈善机构是他们的主要慈善机构,那么他们将为其提供主要支持。)

Change the database to satisfy this requirement.

(更改数据库以满足此要求。)

After making this change add the 'Salvation Army' as the second charity to team number 1.

(进行此更改后,将“救世军”作为第1队的第二个慈善机构。)

The team table currently looks like this:

(目前,团队表如下所示:)

      TEAMNO TEAMNAME                       CARNDATE  TEAMNOMEMBER CHARNAME                          ENTRYID
---------- ------------------------------ --------- ------------ ------------------------------ ----------
         1 Gentle Earth                   04/APR/18            2 Amnesty International                   5
         2 Happy Feet                     04/APR/18            2 Beyond Blue                            14
         3 Avengers                       06/MAY/19            2 Salvation Army                         37
         4 Footloose                      06/MAY/19            3 Salvation Army                         38
         5 Happy Feet                     06/MAY/19            4 Amnesty International                  30

This is what i attempted

(这就是我尝试过的)

alter table team add (
    seccharname       VARCHAR2(30),
    primechar         VARCHAR2(30),
);
UPDATE team

INSERT into team (teamno,seccharname,primechar) VALUES ( values (1,'salvation army','Amnesty International');

Not sure what to do to satisfy the question asked.

(不知道该怎么做才能满足所问的问题。)

  ask by Fish translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Your alter statement needs little bit correction.

(您的alter语句需要一点点纠正。)

You already have CHARNAME column so you can only rename that to primechar.

(您已经有了CHARNAME列,因此只能将其重命名为primechar。)

ALTER TABLE team RENAME CHARNAME TO primechar;

Then Just correct your update statement -

(然后,只需更正您的更新声明-)

UPDATE team
SET seccharname = 'salvation army',
    primechar = 'Amnesty International'
WHERE TEAMNO = 1;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...