Join Bill Weinman for an in-depth discussion in this video Storing text, part of PostgreSQL 9 with PHP Essential Training.
Postgres supports both fixed and variable storage for strings.…Here we are creating a table, and that table has three columns, and they are all…specified as the text type. And we're inserting into each column of a row a thirty-six-character-long string.…And so when I press Go here, you see that that succeeds, and it works exactly as…we expect, and we get the whole thirty-six-character string in each of these columns.…Now let's go ahead and edit this table definition. We'll make this one here VARCHAR(16).…
That's not going to give us enough room for that string.…We'll see what happens. And we'll make this one here a CHAR(16). And now when I go…ahead and execute, you see that we get an error.…So we are getting an error on the VARCHAR(16) because that string is…thirty-six characters long.…So I am going to go ahead and take off the 16, which makes VARCHAR exactly like…text and we'll go ahead and press Go again. And now we see we are getting an…exception for it being too long for the character, which is fixed at 16.…
- 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?
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.