Question 1

The GAME table has a column called Score. This column is has the data type of char(10) and currently allows null values. Change this column so that it does not allow null values.

Answer 1

USE football;
GO
— Enter your query here
ALTER TABLE GAME
ALTER COLUMN Score char(10) NOT NULL;
Go

Question 2

The GAME table has a column called score. The score column is a char(10) data type and currently allows nulls. We would like to change this to not allow nulls but first we need to establish a default value for this column. Write the SQL code to create a default value of ‘0-0’ for the score column in the GAME table.

Answer 2

USE football;
GO
— Enter your query here
ALTER TABLE GAME
ADD CONSTRAINT DF_Score DEFAULT ‘0-0’ FOR Score;
Go

Question 3

The REFEREE table has two columns that record the dates for referees. The column StartDate stores when the referee started with the league while the column EndDate records when they left. The StartDate column is a date data type and cannot contain null values. The EndDate column is a date data type and can contain null values. Create a CHECK constraint so that the EndDate will always occur AFTER the StartDate.

Answer 3

USE football;
GO
— Enter your query here
ALTER TABLE REFEREE
ADD CONSTRAINT CHK_EndDate_After_StartDate CHECK (EndDate > StartDate);
Go

Question 4

The PARENT_PLAYER table currently has two columns ParentID and PlayerID. Both of these columns are integers and primary and foreign keys. Add a column to this table called LivesWith that will be a fixed character data type and only 1 character long. Additionally create a default value of Y and make sure that only Y and N can be entered as possible values in this column.

Answer 4

USE football;
GO
— Enter your query here
ALTER TABLE PARENT_PLAYER
ADD LivesWith CHAR(1) DEFAULT ‘Y’ CHECK (LivesWith IN (‘Y’, ‘N’));
Go

For more assignment solutions like this or SQL homework help contact us now! Hire an expert.