CORRECT Answers
Create a data type with a positive value UNSIGNED
FOREIGN KEY (ColumnName)
Designating a foreign key in CREATE TABLE statement
REFERENCES Tablename(ColumnName),
ALTER TABLE TableName
Command to add a column to an existing table
ADD COLUMN ColumnName DATATYPE;
CREATE VIEW Myview AS
SQL statement to create a view name Myview that contains
SELECT X, Y, Z
X, Y, Z columns from the Maintable table.
FROM Maintable;
SQL statement to delete the view named Myview DROP VIEW Myview;
SQL statement to modify the Test table to make the ID ALTER TABLE Test
column the primary key ADD PRIMARY KEY (ID);
Write a SQL statement to designate the Year column in ALTER TABLE Movie
the Movie table as a foreign key to the Year column in the ADD FOREIGN KEY (Year)
YearStats table. REFERENCES YearStats(Year);
Write a SQL statement to create an index named idx_year CREATE INDEX idx_year
on the Year column of the Movie table. ON Movie (Year);
INSERT INTO Table (column1, column2,...)
SQL statement to add a new row to a table
VALUES (value1, value2,...);
SQL statement to delete a row with ID value of 295 from DELETE FROM Test
Test table WHERE ID = 295;
Statement used to add, delete or modify existing columns.
ALTER TABLE <tablename>
Also used to add or drop constraints
Statement that is used to modify the existing records in a
UPDATE <tablename>
table.
Write a SQL query to output the unique RatingCode values SELECT DISTINCT RatingCode, COUNT(Title) AS Rating-
and the number of movies with each rating value from the CodeCount
Movie table as RatingCodeCount. Sort the results by the FROM Movie