Database Multiple Choice Questions on “SQL Data Types and Schemas”.
1. Dates must be specified in the format
a) mm/dd/yy
b) yyyy/mm/dd
c) dd/mm/yy
d) yy/dd/mm
Answer: b
Clarification: yyyy/mm/dd is the default format in sql.
2. A ________ on an attribute of a relation is a data structure that allows the database system to find those tuples in the relation that have a specified value for that attribute efficiently, without scanning through all the tuples of the relation.
a) Index
b) Reference
c) Assertion
d) Timestamp
Answer: a
Clarification: Index is the reference to the tuples in a relation.
3.
Create index studentID_index on student(ID);
Here which one denotes the relation for which index is created?
a) StudentID_index
b) ID
c) StudentID
d) Student
Answer: d
Clarification: The statement creates an index named studentID index on the attribute ID of the relation student.
4. Which of the following is used to store movie and image files?
a) Clob
b) Blob
c) Binary
d) Image
Answer: b
Clarification: SQL therefore provides large-object data types for character data (clob) and binary data (blob). The letters “lob” in these data types stand for “Large OBject”.
5. The user defined data type can be created using
a) Create datatype
b) Create data
c) Create definetype
d) Create type
Answer: d
Clarification: The create type clause can be used to define new types.Syntax : create type Dollars as numeric(12,2) final; .
6. Values of one type can be converted to another domain using which of the following?
a) Cast
b) Drop type
c) Alter type
d) Convert
Answer: a
Clarification: Example of cast :cast (department.budget to numeric(12,2)). SQL provides drop type and alter type clauses to drop or modify types that have been created earlier.
7.
CREATE DOMAIN YearlySalary NUMERIC(8,2) CONSTRAINT salary VALUE test __________;
In order to ensure that an instructor’s salary domain allows only values greater than a specified value use:
a) Value>=30000.00
b) Not null;
c) Check(value >= 29000.00);
d) Check(value)
Answer: c
Clarification: Check(value ‘condition’) is the syntax.
8. Which of the following closely resembles Create view?
a) Create table . . .like
b) Create table . . . as
c) With data
d) Create view as
Answer: b
Clarification: The ‘create table . . . as’ statement closely resembles the create view statement and both are defined by using queries. The main difference is that the contents of the table are set when the table is created, whereas the contents of a view always reflect the current query result.
9. In contemporary databases, the top level of the hierarchy consists of ______ each of which can contain _____
a) Catalogs, schemas
b) Schemas, catalogs
c) Environment, schemas
d) Schemas, Environment
Answer: a
Clarification: None.
10. Which of the following statements creates a new table temp instructor that has the same schema as an instructor.
a) create table temp_instructor;
b) Create table temp_instructor like instructor;
c) Create Table as temp_instructor;
d) Create table like temp_instructor;
Answer: b