Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

**Write SQL CREATE commands to create the tables, attributes (including data typ

ID: 3680797 • Letter: #

Question

**Write SQL CREATE commands to create the tables, attributes (including data types) and keys in the diagram.**

Consider the following relational database for the Super Baseball League. It keeps track of teams in the league, coaches and players on the teams, work experience of the coaches, bats belonging to each team, and which players have played on which teams. Note the following facts about this environment:

AFFILIATION PLAYER Column Name Data Type Allow Nulls Column Name Data Type Allow Nulls int AFFILIATION PLAYERNLM FK PLAYERNUM BATTINGAVERAGE TEAMNUNM PLAYERNUM int varchan 20) int PLAYERNAME int AGE int WORKEXPERIENCE Column Name Data Type Allow Nulls AFFILIATION TENMINIM FK EXPERIENCETYP YEARS EXPERIENCE TEAMNUM COACHNAME varchan(20) int int varchan(20) TEAM Column Name Data Type Allow Nulls TEAMNUM TEAMNAME CITY MANAGER WORKEXPERI COACH TENMUM FK BATS TEANNUM FK COACH BATS Column Name Data Type Allow Nulls Coumn Name Data Type Allow Nulls SERIALNUM MANUFACTURER TEAMNUM COACHNAME TELEPHONE TEAMNUNM varcharí20) varchar(10) int varchar 20) varchar(20

Explanation / Answer

CREATE TABLE player( PLAYERNUM INT,

                                  PLAYERNAME VARCHAR2(20),

                                   AGE INT,

                                  PRIMARY KEY(PLAYERNUM) )

CREATE TABLE team( TEAMNUM INT,

                              TEAMNAME VARCHAR2(10),

                               CITY VARCHAR2(10),

                                MANAGER VARCHAR2(20),

                               PRIMARY KEY(TEAMNUM) )

CREATE TABLE affliation(YEARS INT,

                                   BATTINGAVERAGE INT,

                                   TEAMNUM INT,

                                 PLAYERNUM INT,

                CONSTRAINT affliation_PLAYERNUM_fk FOREIGN KEY KEY(PLAYRERNUM)

                    REFERENCES player(PLAYERNUM),

                   CONSTRAINT affliation_TEAMNUM_fk FOREIGN KEY (TEAMNUM)
                    REFERENCES team(TEAMNUM) )

CREATE TABLEworkexperience(EXPERIENCETYPE VARCHAR2(20),

                                            YERSEXPERIENCE INT,

                                              TEAMNUM INT,

                                             COACHNAME VARCHAR2(20),

                               PRIMARY KEY(EXPERIENCETYPE),

CONSTRAINT workexperience_COACHNAME_fk FOREIGN KEY (COACHNAME) REFERENCES coach(COACHNAME))


CREATE TABLE coach(COACHNAME VARCHAR2(20),

                               TELEPHONE VARCHAR2(10),

                               TEAMNUM INT,

                           PRIMARY KEY(COACHNAME),

        CONSTRAINT COACH_TEAMNUM_fk FOREIGN KEY (TEAMNUM)         

REFERENCES team(TEAMNUM))

CREATE TABLE bats(SERIALNUM VARCHAR2(10),

                              MANUFACTURER VARCHAR2(20),

                             TEAMNUM INT,

                             PRIMARY KEY(SERIALNUM),

       CONSTRAINT bats_TEAMNUM_fk FOREIGN KEY (TEAMNUM)
         REFERENCES team(TEAMNUM) )