SQL Boolean: How to Store a Boolean in an SQL Database (Many Vendors)

preview_player
Показать описание

A boolean is a true or false value that's used in many programming languages. However, most databases don't have a BOOLEAN data type for us to use.

What do we do if we want to store a boolean value?

There are several options, such as numbers, a CHAR data type, or a VARCHAR.

In this video, I'll explain a recommended approach to store boolean values in several different databases: Oracle, SQL Server, MySQL, and PostgreSQL.

I'll show the Create Table statements for each of these databases, some sample Insert statements, and then Select from the table to see what they look like.

I'll also explain why I don't recommend a specific approach and the reasons for that.

Timestamps:
00:00 Start
00:15 What is a boolean?
00:36 Oracle
01:54 SQL Server
02:49 MySQL
03:47 PostgreSQL
04:26 Character data types
Рекомендации по теме
Комментарии
Автор

LISTEN DATABASE STAR, WHY WOULD YOU LIE TO ME AND MY CLASS? THERE IS A BOOL FUNCTION IN MYSQL. I THOUGHT YOU WOULDNT LIE TO ME AND BE SOMEWHAT OF A KIND PERSON. IM NOT JUST ANGRY, IM DISAPPOINTED!!

Kuehn,
Founder of the Administrationbit

frechodachso