Copyright

SQL Data Types: BOOLEAN

Instructor: Kaitlin Oglesby
Yes or no? This decision is one of the most basic forms of coding that exists and is representative of Boolean language. In fact, in just 10 minutes, you can pick up enough to narrow down your search engine results. Here, it refers to a simple yes or no question for SQL.

What is BOOLEAN?

If the word 'boolean' looks familiar to you, that's because it comes from the idea of Boolean logic. Boolean logic is a simple sort of instructions that can be given to a computer to clarify search and database parameters. If you want to see it in action, try using a popular search engine and combining words that you want to search for together with the word AND.

There are numerous Boolean commands in other applications, but we'll mainly focus with the one used in SQL, which is a simple test of true or false.

Yes or No?

One of the really great features about a database in SQL is that it lets you specify what sort of data is going to make an appearance in each field. For example, INTEGER tells the program to prepare to receive numbers, while ID can be used to assign each record a reference number. However, sometimes you just want to tell SQL to acknowledge whether or not a condition is true. In that case, you'll find yourself using BOOLEAN. Here we will not only further describe BOOLEAN, but how it is used. Additionally, we'll look at an example of the data type in use.

The Use of Boolean Logic

Boolean is almost always used when there is just a need to answer a simple question. Think about it like a check mark in a comparison chart in your mind - there are only two possible answers. Boolean as a data type rejects any other entry, making sure that the person altering the database has to make the conscious decision to either enter true or false. In some older programs, you'll see that represented by 0 or 1, respectively, but the shift is trending towards the use of words instead.

To unlock this lesson you must be a Study.com Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use Study.com

Become a Study.com member and start learning now.
Become a Member  Back
What teachers are saying about Study.com
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? Study.com has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account
Support