Viewers: in countries Watching now:
MySQL is by far the most popular database management system for small- to medium-sized web projects. In this course, Bill Weinman provides clear, concise tutorials that guide you through creating and maintaining a MySQL database of your own. Bill explores the basic syntax, using SQL statements to create, insert, update, and delete data from your tables. He also covers creating a new database from scratch, as well as data types, transactions, subselects, views, and stored routines. Plus, learn about the multi-platform PHP PDO interface that will help you connect your database to web applications.
MySQL doesn't have a Boolean type per se. It does have a Boolean keyword which maps to a tiny int which is then used as a Boolean type. So, let's see how this works. We'll use the scratch database here. And we're going to go ahead and create a little table here. We'll start with a DROP TABLE IF EXISTS. And CREATE TABLE test and it's just going to have two columns a and b and they're both Boolean.
Actually just BOOL by itself is an alias for Boolean, either one works. I like to spell things out. And we're going to insert one row and just put in TRUE and FALSE, true and false. They're just aliases for one and zero, and so true is one and false is zero. And we'll SELECT FROM test, we'll DESCRIBE it, and we'll SHOW CREATE TABLE. Go ahead and Go. So here we have our select here which shows one and zero, and our describe actually shows tiny end for both of the values and you'll notice that it says tiny end one which means that only one digit is going to be used there.
And our CREATE TABLE shows that it's created with tiny and DEFAULT NULL. And so if we come in here and we don't need to describe the any longer and we say SELECT a AND b and SELECT t a OR b. You notice that these can be used, we need FROM test. I do make typos sometimes. And that's fine. And so we see a AND b is not true so it's a 0 because TRUE and FALSE is false.
TRUE or FALSE however is true and so, that returns a 1. So MySQL simply maps its Boolean type to a tiny int, which is then used as a Boolean value. So we can go ahead and DROP our TABLE to put the database back into its original state, and to be ready for the rest of our lessons.
There are currently no FAQs about MySQL Essential Training.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.