Join Bill Weinman for an in-depth discussion in this video Choosing from multiple conditions with the CASE expression, part of PostgreSQL 9 with PHP Essential Training.
The Case operator is used to select between multiple conditions, for example if…we have this table here in the test Database, we get a table with a couple…boolean values and I've inserted one and a zero into them and when I run this…you see we get a 1 for true in column a blank for false in column B. But…perhaps I want to display it differently and I can use a case conditional operator for that.…So let's go over here to our Examples file from Chapter 5 and I'm just going to…copy and paste this SELECT statement in right here.…
This has a couple of CASE conditionals in it.…The first column of this result, which it says as boolA, so that's the first one.…It has this case which begins there and ends with the end.…WHEN a THEN, it will return a TRUE else it will return a FALSE. It's very simple.…We have got exactly the same one here for b and when I run this you see our…second query as boolA and boolB and the first one says TRUE and the second one says FALSE.…So case looks a little bit complicated, but it's really very straightforward.…
- Installing PostgreSQL
- Understanding database architecture
- Inserting, updating, and deleting data in a table
- Creating a database library
- Indexing ID fields
- Storing numbers, text, and Boolean values
- Reading data
- Using casts to force type
- Using mathematical functions
- Concatenating strings
- Working with date and time functions and operators
- Defining CRUD
- Using PHP to insert, read, update, and delete rows in a database
Skill Level Beginner
1. Quick Start
2. Creating a Database
3. Data Types
4. Storing and Reading Data
5. SQL Expressions
6. Mathematical Functions and Operators
Using math functions3m 2s
7. String Functions and Operators
8. Date and Time Functions and Operators
9. PHP Interfaces
10. Web Applications
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.