Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create Table TransactionLog ( LogID int identity(1,1) primary key, LogTime datetime, LogType char(1), BeforeState nvarchar(500), AfterState nvarchar(500), ) Player (PlayerID.int, FirstName: nvarchar(25), LastName: nvarchar(25), Nationality:

image text in transcribed Create Table TransactionLog ( LogID int identity(1,1) primary key, LogTime datetime, LogType char(1), BeforeState nvarchar(500), AfterState nvarchar(500), )

image text in transcribed

Player (PlayerID.int, FirstName: nvarchar(25), LastName: nvarchar(25), Nationality: varchar(25), Birthdate: smalldatetime, Age: smallint, Position: varchar(25)) Team (TeamID:int, Name: nvarchar(50), City: nvarchar(25)) PlayerTeam (PlayerID:int, TeamID: int, Season varchar(5)) Match (MatchiD:int, HomeTeamID:int, VisitingTeamID: int, DateOfMatch: smalldatetime, Week: tinyint) Goals (MatchID: int, PlayerlD. int, IsOwnGoal: bit, Minute: tinyint) Notes: Table Match stores data only for season 2013-2014. Table Goals stores data only for season 2013-2014. 2) Implement a trigger Trg_RearrangeStandings with the followings: When a record is inserted into, deleted from or updated on the table Goals (any change for Matchid, PlayerID and/or IsOwnGoal); then rearrange the table Standings, and insert a relevant record into the table TransactionLog. In all type of operations (insert, delete, update); Player D in table Goals must be a player of either the home team or the visiting team for that match in season 13-14. In any wrong match-team-player assignments, the transaction will be rolled back and any further executions will be stopped. A value less than 1 or greater than 90 cannot be entered in the field Goals. Minute. TransactionLog.LogTime is the time of operation. TransactionLog.LogType is l" for insertion, "D" for deletion and "U" for update operation/transaction. TransactionLog. Beforestate is null for insertion and TransactionLog.AfterState is null for deletion. For update operation, Before State is the one before the operation and AfterState is the one after the operation. For the fields Before State and AfterState in table TransactionLog, concatenate all the related fields (Matchid, PlayerID, ISOwnGoal, Minute) in table Goals and separate them by a semicolon (e.g. '306;324;0;58') and enter this data in the fields Before State and AfterState, accordingly. . . 3) Consider the unnormalized relation R with six attributes ABCDEF and the following functional dependencies: AB CDE BF CD a) What is the key(s) for the relation? b) What is the normal form of this relation? Explain it. c) Decompose Rinto 3NF relations step by step if it is not in 3NF

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions

Question

2. Show the trainees how to do it without saying anything.

Answered: 1 week ago