Database Questions and Answers – SQL Data Types and Schemas

This set of Database Multiple Choice Questions & Answers (MCQs) focuses 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
View Answer

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

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

3.

Create index studentID_index on student(ID);
advertisement
advertisement

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. 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”.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

5. 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. 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.
advertisement

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)
View Answer

Answer: c
Explanation: 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
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.
advertisement

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
View Answer

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

Answer: b
Explanation: None.

Sanfoundry Global Education & Learning Series – Database Management System.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.