DBI202 Exam Questions with 100% Correct
Answers
A CASE SQL statement is which of the following?
Select one:
A way to establish a loop in SQL
A way to establish a data definition in SQL
All of the above
A way to establish an IF-THEN-ELSE in SQL
A way to establish an IF-THEN-ELSE in SQL
A domain of PaymentMethod attributes in Invoice relation have 2 types: Cash,
Transfer. Which statement is used to validate the data entries?
Select one:
...CHECK PaymentMethod = ('Cash','Transfer')
...CHECK PaymentMethod IN ('Cash','Transfer')
...CHECK (PaymentMethod IN ('Cash','Transfer')
...CHECK (PaymentMethod = 'Cash' AND PaymentMethod = 'Transfer')
...CHECK (PaymentMethod IN ('Cash','Transfer')
A relationship is when both participants in the relationship are the same entity set is
called
Select one:
Ternary
N-ary
Binary
Unary
,Unary
A trigger belongs to_______________
Select one:
a single table in the database
all tables in the database
none of the others
more than one table in the database
a single table in the database
Choose the correct statement.
Select one:
All of the others
The syntax to remove a trigger is: DROP TRIGGER < trigger_name >
You can remove a trigger by dropping it or by dropping the trigger table.
Use ALTER TRIGGER to change the definition of a trigger
All of the others
Give the SQL statement: SELECT * FROM Worker WHERE first_name like '%a%'
Select one:
This statement is used to print details of the workers whose first_name begins with 'a'
This statement is used to print details of the workers whose first_name ends with 'a'
This statement is used to print details of the workers whose first_name begins and ends
with 'a'
This statement is used to print details of the workers whose first_name contains 'a'
This statement is used to print details of the workers whose first_name contains 'a'
,How many tables may be included with a join?
Select one:
Four
One
Three
Two
Two
In SQL, Students(Stu_ID, Stu_Name, Stu_Age, Stu_Sex) . How can you return the
number of record in the "Students" table? Choose the correct
answer(s).
Select one or more:
Select count (Stu_ID) from Students group by Stu_ID
Select * from Students
Select count(Stu_ID) from Students
Select count(*) from Students
Select count (Stu_ID) from Students group by Stu_ID
Select count(Stu_ID) from Students
SELECT SUBSTRING('SQL_SERVER', 2, 3) AS 'Substring',
len(SUBSTRING('SQL_SERVER', 2, 3)) AS 'x'
Select one:
Substring is 'SQL' and x=3
Substring is 'QL_' and x=3
Substring is '_S' and x=2
Substring is 'QL_' and x=2
, Substring is 'QL_' and x=3
SQL data definition commands make up a(n)___________.
Select one:
DML
DDL
XML
HTML
DDL
Suppose there are two relations R1(A, B,C, D) and R2(E, F, G). A referential integrity
constraint from attribute G of R2 to attribute A of R1,
where A is a primary key of R1. Which of the followings can violate this constraint?
(Choose the correct answers)
Select one or more:
Delete an exist tuple from the relation R1
Delete an exist tuple from the relation R2
Insert a new tuple to the relation R1
Insert a new tuple to the relation R2
Insert a new tuple to the relation R2, Delete an exist tuple from the relation R1
Suppose you want to compare three keys ('Primary Key', 'Super Key', and 'Candidate
Key') in database. Which of the following option(s)
is/are correct?
Select one or more:
We cannot find "Primary Key" from "Candidate Key"
All Super Keys can be a Candidate Key
Answers
A CASE SQL statement is which of the following?
Select one:
A way to establish a loop in SQL
A way to establish a data definition in SQL
All of the above
A way to establish an IF-THEN-ELSE in SQL
A way to establish an IF-THEN-ELSE in SQL
A domain of PaymentMethod attributes in Invoice relation have 2 types: Cash,
Transfer. Which statement is used to validate the data entries?
Select one:
...CHECK PaymentMethod = ('Cash','Transfer')
...CHECK PaymentMethod IN ('Cash','Transfer')
...CHECK (PaymentMethod IN ('Cash','Transfer')
...CHECK (PaymentMethod = 'Cash' AND PaymentMethod = 'Transfer')
...CHECK (PaymentMethod IN ('Cash','Transfer')
A relationship is when both participants in the relationship are the same entity set is
called
Select one:
Ternary
N-ary
Binary
Unary
,Unary
A trigger belongs to_______________
Select one:
a single table in the database
all tables in the database
none of the others
more than one table in the database
a single table in the database
Choose the correct statement.
Select one:
All of the others
The syntax to remove a trigger is: DROP TRIGGER < trigger_name >
You can remove a trigger by dropping it or by dropping the trigger table.
Use ALTER TRIGGER to change the definition of a trigger
All of the others
Give the SQL statement: SELECT * FROM Worker WHERE first_name like '%a%'
Select one:
This statement is used to print details of the workers whose first_name begins with 'a'
This statement is used to print details of the workers whose first_name ends with 'a'
This statement is used to print details of the workers whose first_name begins and ends
with 'a'
This statement is used to print details of the workers whose first_name contains 'a'
This statement is used to print details of the workers whose first_name contains 'a'
,How many tables may be included with a join?
Select one:
Four
One
Three
Two
Two
In SQL, Students(Stu_ID, Stu_Name, Stu_Age, Stu_Sex) . How can you return the
number of record in the "Students" table? Choose the correct
answer(s).
Select one or more:
Select count (Stu_ID) from Students group by Stu_ID
Select * from Students
Select count(Stu_ID) from Students
Select count(*) from Students
Select count (Stu_ID) from Students group by Stu_ID
Select count(Stu_ID) from Students
SELECT SUBSTRING('SQL_SERVER', 2, 3) AS 'Substring',
len(SUBSTRING('SQL_SERVER', 2, 3)) AS 'x'
Select one:
Substring is 'SQL' and x=3
Substring is 'QL_' and x=3
Substring is '_S' and x=2
Substring is 'QL_' and x=2
, Substring is 'QL_' and x=3
SQL data definition commands make up a(n)___________.
Select one:
DML
DDL
XML
HTML
DDL
Suppose there are two relations R1(A, B,C, D) and R2(E, F, G). A referential integrity
constraint from attribute G of R2 to attribute A of R1,
where A is a primary key of R1. Which of the followings can violate this constraint?
(Choose the correct answers)
Select one or more:
Delete an exist tuple from the relation R1
Delete an exist tuple from the relation R2
Insert a new tuple to the relation R1
Insert a new tuple to the relation R2
Insert a new tuple to the relation R2, Delete an exist tuple from the relation R1
Suppose you want to compare three keys ('Primary Key', 'Super Key', and 'Candidate
Key') in database. Which of the following option(s)
is/are correct?
Select one or more:
We cannot find "Primary Key" from "Candidate Key"
All Super Keys can be a Candidate Key