Questions and CORRECT Answers
San Francisco, CA 94110 USA ,
4 Attributes
How many attributes are present in the address fragment?
The Package table has the following columns:
Weight—decimal,
Description—optional variable length string,
LastChangedDate—date, TrackingNumber— TrackingNumber
integer,
Which column should be designated the primary key for
the Package table?
Which data type will store "2022-01-10 14:22:12" as a
DATETIME
temporal value without loss of information?
Which SQL command is an example of data definition
CREATE, ALTER, DROP, RENAME, TRUNICATE
language (DDL)?
TRUNCATE removes all rows, unlike DELETE, which re-
What does the SQL keyword command TRUNCATE do?
moves specific rows.
RESTRICT CONSTRAINT will reject the UPDATE if the input
How would a database engine process an update that
does not coincide with predetermined values and gener-
violates a RESTRICT referential integrity constraint?
ates an error.
Which restrictions applies when using a materialized Materialized views require to be refreshed frequently and
view? require more storage space.
Define a SELECT statement? SELECT column1, column2, ... FROM table_name;
INSERT INTO table_name (column1, column2, ...)
Define a INSERT statement?
VALUES (value1, value2, ...);
UPDATE table_name
Define a UPDATE statement? SET column1 = value1, column2 = value2, ...
WHERE condition;
DELETE FROM table_name
Define a DELETE statement?
,WHERE condition;
, The Book table has the following columns:
genre - varchar(20),
pages - integer,
author_id - char(3), isbn_number
isbn_number - varchar(20),
Which column should be designated at the primary key
for the Book table?
The Book table has the following columns:
genre - varchar(20),
pages - integer,
author_id - char(3), author_id
isbn_number - varchar(20),
Which column should be designated as the foreign key
for the Book table?
Which data type represents numbers with fractional val-
DECIMAL
ues:
Which of the following is a DML command? INSERT, DELETE, UPDATE
CREATE TABLE Invoice (
invoice_id INT NOT NULL AUTO_INCREMENT,
date DATE NOT NULL,
customer_id INT NOT NULL,
PRIMARY KEY (invoice_id),
FOREIGN KEY (customer_id) REFERENCES Customer (cus-
tomer_id) ON DELETE CASCADE Those invoices would be deleted also.
);
Looking at the Customer and Invoice tables and the CRE-
ATE TABLE for the Invoice table with foreign key reference
statement above, what would happen to invoices in the
Invoice table that are linked to a customer if that customer
is deleted.