Correct Answers | Verified | Latest Update
Answers at the end of the test
1. Which..of..the..following..functions..would..be..used..to..combine..two..columns:
a. TRUNCATE()
b. AGGREGATE()
c. SUBSTRING()
d. CONCAT()
2. The..Book..table..has..the..following..columns
:..genre..–..varchar(20)
pages..–
..integer..author_id..–
..char(3)
isbn_number..–..varchar(20)
Which..column..should..be..designated..at..the..primary..key..for..the..Book..table?
a. genre
b. pages
c. author_id
d. isbn_number
3. The..Book..table..has..the..following..columns
:..genre..–..varchar(20)
pages..–
..integer..author_id..–
..char(3)
isbn_number..–..varchar(20)
Which..column..should..be..designated..as..the..foreign..key..for..the..Book..table?
a. genre
b. pages
c. author_id
d. isbn_number
4. Which..data..type..represents..numbers..with..fractional..values:
a. Integer
b. Decimal
c. Character
d. Binary
,5. Which..of..the..following..is..a..DDL..commands?
a. INSERT
b. SELECT
c. CREATE..INDEX
d. UPDATE
6. Which..of..the..following..is..a..DML..command?
a. CREATE..VIEW
b. CREATE..TABLE
c. INSERT
d. ALTER..INDEX
7.
CREATE..TABLE..Invoice..(
invoice_id INT
NOT..NULL. . AUTO_INCREMENT,..date
DATE NOT..NULL,
customer_id INT
NOT..NULL..UNIQUE,..PRIMA
RY..KEY..(invoice_id),
FOREIGN..KEY..(customer_id)..REFERENCES. . Customer. . (customer_id)..ON..DELETE.
.CASCADE
);
Looking..at..the..Customer..and..Invoice..tables..and..the..CREATE..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.
a. Those..invoices..would..remain..in..the..database.
b. Those..invoices..would..be..deleted..also.
c. The..Customer..ID..for..those..invoices..would..be..changed..to..NULL.
d. Nothing..would..happen.
Customer..ID..(PK)..Custom Invoice..ID..(PK)..Dat
er..Last..Name..Customer..Fir e
st..Name..Street..Address Customer..ID..(FK)
City..
State
,8.
CREATE..TABLE..Invoice..(
invoice_id INT
NOT..NULL. . AUTO_INCREMENT,..date
DATE NOT..NULL,
customer_id INT
NOT..NULL,..PRIMA
RY..KEY..(invoice_id),
FOREIGN..KEY..(customer_id)..REFERENCES. . Customer. . (customer_id)..ON..DELETE.
.RESTRICT
);
Looking..at..the..Customer..and..Invoice..tables..and..the..CREATE..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.
a) Those..customers..would..remain..in..the..customer..database.
b) Those..invoices..would..be..deleted..also.
c) The..Customer..ID..for..those..invoices..would..be..changed..to..NULL.
d) The..delete..of..the..invoices..would..not..be..allowed.
Customer..ID..(PK)..Custom Invoice..ID..(PK)..Dat
er..Last..Name..Customer..Fir e
st..Name..Street..Address Customer..ID..(FK)
City..
State
..Zip
9.
CREATE..TABLE..Invoice..(
, invoice_id INT
NOT..NULL. . AUTO_INCREMENT,..date
DATE NOT..NULL,
customer_id INT
NOT..NULL,..PRIMA
RY..KEY..(invoice_id),
FOREIGN..KEY..(customer_id)..REFERENCES. . Customer. . (customer_id)..ON..DELETE..SET..TO..
NULL
);
Looking..at..the..Customer..and..Invoice..tables..and..the..CREATE..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.
a. Those..invoices..would..remain..in..the..database.
b. Those..invoices..would..be..deleted..also.
c. The..Customer..ID..for..those..invoices..would..be..changed..to..NULL.
d. The..delete..of..the..Customer..would..not..be..allowed.
Customer..ID..(PK)..Custom Invoice..ID..(PK)..Dat
er..Last..Name..Customer..Fir e
st..Name..Street..Address Customer..ID..(FK)
City..
State
..Zip
10.
Which..of..the..following..are..true..about..materialized..view..(Choose..2)?
a. It..is..a..base..table.
b. It..is..stored.
c. It..must..be..refreshed..whenever..the..base..table..changes.
d. The..results..are..stored..as..a..temporary..table.
11.
The..Customer..table..will..have..the..following..columns:..
CustomerID—positive..integer