Question

Question 2: SQL-5 marks Using the GAMEMEMBERS relational schema below a) List the order in which the tables were created? b)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

This demonstration is using SQL Server 2014.Database and Tables are created using SQL Server Management Studio (SSMS).

Question a: Below is the list in the order table needs to be created.

  1. GAME
  2. LEVEL
  3. REGION
  4. MEMBER
  5. GAMEMEMBER

Question b:

1.Table Name :GAME

--Table Name:GAME
create table GAME(
gameID varchar(4) primary key,
GameName varchar(10)
);

2.Table Name :LEVEL


--Table Name:Level
create table level(
LevelID char(1) primary key,
Level varchar(10));

3.Table Name :REGION

create table region (
RegionID int primary key,
RegionName varchar(20)
);

4.Table Name :MEMBER

create table member(
memberID varchar(4) primary key,
FName varchar(20) ,
LName varchar(20) ,
Address varchar(30) ,
suburb varchar(20) ,
State varchar(20),
PostalCode varchar(20),
RegionID int foreign key references region(RegionID)
);

5.Table Name :GAMEMEMBER

--Table Name :GameMember
create table GameMember(
GamesMemberID int primary key,
MemberID varchar(4) ,
GameID varchar(4),
LevelID char(1),
Date date,
foreign key (GameID) references Game(GameID),
foreign key (MemberID) references Member (MemberID),
foreign key (LevelID) references Level (LevelID)
);
Question 3 :

--insert record into game table
insert into game values('S001',null);
insert into game values('S002',null);
insert into game values('S003',null);

--insert record into level table
insert into level values('A',null);
insert into level values('B',null);
insert into level values('C',null);

--Insert records into members table
insert into member (memberID) values ('M898');
insert into member (memberID) values ('M888');
insert into member (memberID) values ('M222');

--Insert records into Gamemember table
insert into Gamemember values (0101,'M898','S001','A','2016/08/20');
insert into Gamemember values (0102,'M888','S001','C','2012/08/21');
insert into Gamemember values (0103,'M898','S002','B','2012/08/21');
insert into Gamemember values (0104,'M222','S003','C','2012/08/22');

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Add a comment
Know the answer?
Add Answer to:
Question 2: SQL-5 marks Using the GAMEMEMBERS relational schema below a) List the order in which the tables were created? b) Write the CREATE TABLE statement for MEMBER table. Use appropriate dat...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question 1.Write a SQL statement for each of the following questions based on the above tables...

    Question 1.Write a SQL statement for each of the following questions based on the above tables (50 Points). 1) Create “Enrollment” table. 2) Change the credits of “Database” course from 2 to 3. 3) List the course titles (not Course_No) and grades John Doe had taken. 4) Calculate average of Café Balance, and name new field as Average Balance. 5) Create a roster for “Database” course (list student ID, last name, first name, major, and status for each student enrolled...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT