DATABASE MANAGEMENT APPLICATIONS
EXAM |ACCURATE AND VERIFIED | LATEST
UPDATE 2025/2026
_____________________________________________________________________________________
The Vehicle table has the following columns:
ID—integer, primary key
Make—variable-length string
Model—variable-length string
Year—integer
A new column must be added to the Vehicle table:
Column name: EngineSize
Data type: A positive decimal value less than or equal to 7.9 with one decimal.
Write a SQL statement to add the EngineSize column to the Vehicle table.
ALTER TABLE Vehicle
ADD EngineSize DECIMAL(2,1)
UNSIGNED CHECK(EngineSize <=7.9);
The Song table has the following columns:
ID—integer, primary key
Title—variable-length string
Genre—variable-length string
Year—integer
Write a SQL statement to create a view named MyMusic that contains the Title, Genre, and Year
columns for all songs. Ensure your result set returns the columns in the order indicated.
CREATE VIEW MyMusic AS
SELECT Title, Genre, Year
FROM Song;
A database has a view named MyMusic.
Write a SQL statement to delete the view named MyMusic from the database.
DROP VIEW MyMusic;
The Pet table has the following columns:
PetID - integer
Name - variable-length string
Breed - variable-length string
, Birthdate - date
Write a SQL statement to modify the Pet table to make the PetID column the primary key.
ALTER TABLE Pet
ADD PRIMARY KEY (PetID);
The Dog table has the following columns:
dogID - integer, primary key
name - variable-length string
breedID - integer
birthdate - date
The Breed table has the following columns:
breedID—integer
breedDescription—varchar
Releases—integer
Write a SQL statement to designate the breedID column in the Dog table as a foreign key to the
breedID column in the Breed table.
ALTER TABLE Dog
ADD FOREIGN KEY (breedID)
REFERENCES Breed (breedID);
The Song table has the following columns:
ID—integer, primary key
Title—variable-length string
Genre—variable-length string
Year—integer
Write a SQL statement to create an index named idx_year on the Year column of the Song table.
CREATE INDEX idx_year
ON Song (Year);
The Podcast table has the following columns:
podcastID—integer, primary key, auto_increment
Title—variable-length string
Genre - variable-length string
Speaker—variable-length string
Minutes—integer
The following data needs to be added to the Podcast table:
Title Speaker Genre Minutes
Rock Painting Kecia McDonald No Data 25
Write a SQL statement to insert the indicated data into the Podcast table.
EXAM |ACCURATE AND VERIFIED | LATEST
UPDATE 2025/2026
_____________________________________________________________________________________
The Vehicle table has the following columns:
ID—integer, primary key
Make—variable-length string
Model—variable-length string
Year—integer
A new column must be added to the Vehicle table:
Column name: EngineSize
Data type: A positive decimal value less than or equal to 7.9 with one decimal.
Write a SQL statement to add the EngineSize column to the Vehicle table.
ALTER TABLE Vehicle
ADD EngineSize DECIMAL(2,1)
UNSIGNED CHECK(EngineSize <=7.9);
The Song table has the following columns:
ID—integer, primary key
Title—variable-length string
Genre—variable-length string
Year—integer
Write a SQL statement to create a view named MyMusic that contains the Title, Genre, and Year
columns for all songs. Ensure your result set returns the columns in the order indicated.
CREATE VIEW MyMusic AS
SELECT Title, Genre, Year
FROM Song;
A database has a view named MyMusic.
Write a SQL statement to delete the view named MyMusic from the database.
DROP VIEW MyMusic;
The Pet table has the following columns:
PetID - integer
Name - variable-length string
Breed - variable-length string
, Birthdate - date
Write a SQL statement to modify the Pet table to make the PetID column the primary key.
ALTER TABLE Pet
ADD PRIMARY KEY (PetID);
The Dog table has the following columns:
dogID - integer, primary key
name - variable-length string
breedID - integer
birthdate - date
The Breed table has the following columns:
breedID—integer
breedDescription—varchar
Releases—integer
Write a SQL statement to designate the breedID column in the Dog table as a foreign key to the
breedID column in the Breed table.
ALTER TABLE Dog
ADD FOREIGN KEY (breedID)
REFERENCES Breed (breedID);
The Song table has the following columns:
ID—integer, primary key
Title—variable-length string
Genre—variable-length string
Year—integer
Write a SQL statement to create an index named idx_year on the Year column of the Song table.
CREATE INDEX idx_year
ON Song (Year);
The Podcast table has the following columns:
podcastID—integer, primary key, auto_increment
Title—variable-length string
Genre - variable-length string
Speaker—variable-length string
Minutes—integer
The following data needs to be added to the Podcast table:
Title Speaker Genre Minutes
Rock Painting Kecia McDonald No Data 25
Write a SQL statement to insert the indicated data into the Podcast table.