ISDS 3003 CH 3 & 5 QUESTIONS AND ANSWERS
Which of the following data types used in SQL would define a fixed-length text field of
10 characters? - Answer -char(10)
Which of the following data types used in SQL would define a numeric field of the
pattern 99.99? - Answer -numeric(2,2)
Which of the following is NOT a standard data type used in SQL? - Answer -Text
Which of the following is NOT true about primary keys? - Answer -Primary keys must
be a single attribute.
A composite primary key can be defined using the CONSTRAINT phrase in which SQL
command? - Answer -CREATE TABLE
Which of the following CANNOT be done using the CONSTRAINT phrase? - Answer -
a.) Define a foreign key.
b.) Create a single attribute primary key.
c.) Establish a referential integrity constraint.
*d.) All of the above can be done using the CONSTRAINT phrase.
e.) None of the above can be done using the CONSTRAINT phrase.
Given the table
STUDENT(StudentID, Name, Advisor)
which of the following SQL statements would be used to add new student data to the
STUDENT table? - Answer -INSERT INTO STUDENT VALUES (123, 'Jones', 'Smith');
The order of the columns returned by an SQL SELECT statement is determined by the -
Answer -order they are listed in following SELECT.
Which SQL keyword is used to eliminate duplicate rows in the results of an SQL
SELECT query? - Answer -DISTINCT
Which SQL keyword is used to specify a condition that rows must meet to be included in
the results of an SQL SELECT query? - Answer -WHERE
Conditions after the WHERE keyword require single quotes around the values for
columns that have which data type? - Answer -a.) Char
b.) VarChar
c.) Integer
d.) Numeric
*e.) Both A and B
, Which of the following is the correct SQL clause to restrict the results of a SELECT
query to only records that have a value in the range of 10 to 50 in the Hours column? -
Answer -WHERE Hours BETWEEN 10 AND 50
Which symbol is used in standard SQL as a wildcard to represent a single, unspecified
character? - Answer -_ (underscore)
Which symbol is used in standard SQL as a wildcard to represent a series of one or
more unspecified characters? - Answer -% (percent sign)
Which SQL keyword can be used in conjunction with wildcards to select partial values?
- Answer -LIKE
Which of the following is the correct SQL clause to sort the results of a SELECT query
in reverse-alphabetic order using the Department field? - Answer -ORDER BY
Department DESC
Which of the following is not one of the five SQL built-in functions? - Answer -MODE
Given the table
CUSTOMER(CustID, Name, PhoneNum, AcctBalance)
what is the standard SQL query phrase to retrieve the Name and Phone Number of
customers? - Answer -SELECT Name, PhoneNum
Given the table
CUSTOMER(CustID, Name, PhoneNum, AcctBalance)
what is the standard SQL query phrase to retrieve data for customers with an account
balance greater than 50? - Answer -WHERE AcctBalance > 50
Which SQL keyword is used to apply conditions to restrict groups that appear in the
results of a SELECT query that uses GROUP BY? - Answer -HAVING
Given the tables
STUDENT(StudentID, StudentName, AdvisorID)
ADVISOR(AdvisorID, AdvisorName, Office, Phone)
which of the following SQL statements would be used to implant a join between the two
tables? - Answer -WHERE STUDENT JOIN ADVISOR ON STUDENT.AdvisorID =
ADVISOR.AdvisorID
Which of the following data types used in SQL would define a fixed-length text field of
10 characters? - Answer -char(10)
Which of the following data types used in SQL would define a numeric field of the
pattern 99.99? - Answer -numeric(2,2)
Which of the following is NOT a standard data type used in SQL? - Answer -Text
Which of the following is NOT true about primary keys? - Answer -Primary keys must
be a single attribute.
A composite primary key can be defined using the CONSTRAINT phrase in which SQL
command? - Answer -CREATE TABLE
Which of the following CANNOT be done using the CONSTRAINT phrase? - Answer -
a.) Define a foreign key.
b.) Create a single attribute primary key.
c.) Establish a referential integrity constraint.
*d.) All of the above can be done using the CONSTRAINT phrase.
e.) None of the above can be done using the CONSTRAINT phrase.
Given the table
STUDENT(StudentID, Name, Advisor)
which of the following SQL statements would be used to add new student data to the
STUDENT table? - Answer -INSERT INTO STUDENT VALUES (123, 'Jones', 'Smith');
The order of the columns returned by an SQL SELECT statement is determined by the -
Answer -order they are listed in following SELECT.
Which SQL keyword is used to eliminate duplicate rows in the results of an SQL
SELECT query? - Answer -DISTINCT
Which SQL keyword is used to specify a condition that rows must meet to be included in
the results of an SQL SELECT query? - Answer -WHERE
Conditions after the WHERE keyword require single quotes around the values for
columns that have which data type? - Answer -a.) Char
b.) VarChar
c.) Integer
d.) Numeric
*e.) Both A and B
, Which of the following is the correct SQL clause to restrict the results of a SELECT
query to only records that have a value in the range of 10 to 50 in the Hours column? -
Answer -WHERE Hours BETWEEN 10 AND 50
Which symbol is used in standard SQL as a wildcard to represent a single, unspecified
character? - Answer -_ (underscore)
Which symbol is used in standard SQL as a wildcard to represent a series of one or
more unspecified characters? - Answer -% (percent sign)
Which SQL keyword can be used in conjunction with wildcards to select partial values?
- Answer -LIKE
Which of the following is the correct SQL clause to sort the results of a SELECT query
in reverse-alphabetic order using the Department field? - Answer -ORDER BY
Department DESC
Which of the following is not one of the five SQL built-in functions? - Answer -MODE
Given the table
CUSTOMER(CustID, Name, PhoneNum, AcctBalance)
what is the standard SQL query phrase to retrieve the Name and Phone Number of
customers? - Answer -SELECT Name, PhoneNum
Given the table
CUSTOMER(CustID, Name, PhoneNum, AcctBalance)
what is the standard SQL query phrase to retrieve data for customers with an account
balance greater than 50? - Answer -WHERE AcctBalance > 50
Which SQL keyword is used to apply conditions to restrict groups that appear in the
results of a SELECT query that uses GROUP BY? - Answer -HAVING
Given the tables
STUDENT(StudentID, StudentName, AdvisorID)
ADVISOR(AdvisorID, AdvisorName, Office, Phone)
which of the following SQL statements would be used to implant a join between the two
tables? - Answer -WHERE STUDENT JOIN ADVISOR ON STUDENT.AdvisorID =
ADVISOR.AdvisorID