WGU D427 PRACTICE TEST QUESTIONS AND ANSWERS
The Member table will contain the following columns:
ID—positive integer
FirstName—variable-length string with up to 100 characters
MiddleInitial—fixed-length string with 1 character
LastName—variable-length string with up to 100 characters
DateOfBirth—date
AnnualPledge—positive decimal value representing a cost of up to $999,999,
with 2 digits for cents
Write a SQL statement that creates the Member table. - ANSWER CREATE
TABLE Member (
ID INT UNSIGNED,
FirstName VARCHAR(100),
MiddleInitial CHAR(1),
LastName VARCHAR(100),
DateOfBirth DATE,
AnnualPledge DECIMAL(9, 2)
);
Rating Table Columns
RatingCode—variable-length string, primary key
RatingDescription—variable-length string
, The columns for the Movie table are as follows:
Title—variable-length string, maximum 30 characters
RatingCode—variable-length string, maximum 5 characters
Write SQL to create a Movie table. Make the RatingCode column of the Movie
table a foreign key to the RatingCode column of the Rating table. - ANSWER
CREATE TABLE Movie (
Title VARCHAR(30),
RatingCode VARCHAR(5),
FOREIGN KEY (RatingCode) REFERENCES Rating(RatingCode)
);
The following columns are in the Movie table:
ID—integer, primary key
Title—variable-length string
Genre—variable-length string
RatingCode—variable-length string
Year—integer
Add the following column to the Movie table:
Column name: Score
Data type: decimal(3,1)
Write a SQL statement to add the Score column to the Movie table. - ANSWER
ALTER TABLE Movie
The Member table will contain the following columns:
ID—positive integer
FirstName—variable-length string with up to 100 characters
MiddleInitial—fixed-length string with 1 character
LastName—variable-length string with up to 100 characters
DateOfBirth—date
AnnualPledge—positive decimal value representing a cost of up to $999,999,
with 2 digits for cents
Write a SQL statement that creates the Member table. - ANSWER CREATE
TABLE Member (
ID INT UNSIGNED,
FirstName VARCHAR(100),
MiddleInitial CHAR(1),
LastName VARCHAR(100),
DateOfBirth DATE,
AnnualPledge DECIMAL(9, 2)
);
Rating Table Columns
RatingCode—variable-length string, primary key
RatingDescription—variable-length string
, The columns for the Movie table are as follows:
Title—variable-length string, maximum 30 characters
RatingCode—variable-length string, maximum 5 characters
Write SQL to create a Movie table. Make the RatingCode column of the Movie
table a foreign key to the RatingCode column of the Rating table. - ANSWER
CREATE TABLE Movie (
Title VARCHAR(30),
RatingCode VARCHAR(5),
FOREIGN KEY (RatingCode) REFERENCES Rating(RatingCode)
);
The following columns are in the Movie table:
ID—integer, primary key
Title—variable-length string
Genre—variable-length string
RatingCode—variable-length string
Year—integer
Add the following column to the Movie table:
Column name: Score
Data type: decimal(3,1)
Write a SQL statement to add the Score column to the Movie table. - ANSWER
ALTER TABLE Movie