Question:

Which data type is used in SQL to store true or false values ?

Show Hint

While different database systems might implement it differently (e.g., as `BIT` or `TINYINT`), the logical data type for true/false is always `BOOLEAN`.
  • int
  • Boolean
  • Varchar
  • Float
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Step 1: Understand the requirement. The goal is to store a value that can only be true or false. This is known as a boolean or logical value.
Step 2: Analyze the SQL data types.

(A) \text{int}: Stores integer numbers.
(B) \text{Boolean}: Specifically designed to store true/false values. Some SQL dialects use \text{BIT} or a small integer (\text{TINYINT(1)}) for the same purpose, but \text{Boolean} is the conceptual answer.
(C) \text{Varchar}: Stores variable-length strings of text.
(D) \text{Float}: Stores floating-point (decimal) numbers.
Therefore, \text{Boolean} is the correct data type for storing true or false values.
Was this answer helpful?
0
0