Engineering Questions with Answers - Multiple Choice Questions

Database MCQ – SQL Data Types and Schemas

1 - Question

Dates must be specified in the format
a) mm/dd/yy
b) yyyy/mm/dd
c) dd/mm/yy
d) yy/dd/mm

View Answer

Answer: b
Explanation: yyyy/mm/dd is the default format in sql.




2 - Question

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

View Answer

Answer: a
Explanation: Index is the reference to the tuples in a relation.




3 - Question

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

View Answer

Answer: d
Explanation: The statement creates an index named studentID index on the attribute ID of the relation student.




4 - Question

Which of the following is used to store movie and image files?
a) Clob
b) Blob
c) Binary
d) Image

View Answer

Answer: b
Explanation: 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 - Question

The user defined data type can be created using
a) Create datatype
b) Create data
c) Create definetype
d) Create type

View Answer

Answer: d
Explanation: The create type clause can be used to define new types.Syntax : create type Dollars as numeric(12,2) final; .




6 - Question

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

View Answer

Answer: a
Explanation: 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 - Question

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)

View Answer

Answer: c
Explanation: Check(value ‘condition’) is the syntax.




8 - Question

Which of the following closely resembles Create view?
a) Create table . . .like
b) Create table . . . as
c) With data
d) Create view as

View Answer

Answer: b
Explanation: 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 - Question

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

View Answer

Answer: a
Explanation: None.




10 - Question

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;

View Answer

Answer: b
Explanation: None.

Get weekly updates about new MCQs and other posts by joining 18000+ community of active learners