Join Bill Weinman for an in-depth discussion in this video Indexing ID fields, part of PostgreSQL 9 with PHP Essential Training.
Like most database systems, Postgres provides a simple and straightforward…facility for creating automatically incrementing integers for ID columns.…This facility is called Serial Primary Key.…I am just going to paste some SQL in here, and you'll see that if we create a…table with a field that has a type of Serial Primary Key that this can be…nicely used for an id field.…So let's go ahead and create this and watch what happens.…
Now the first thing we will notice about this is when we take a look at the…index definition--go ahead and run that query--…you see that we get a primary key index.…And that's just we would expect if it were text primary key or any other kind of a primary key.…So that's used for the constraint so all those values are unique and non-null.…Now there is another behavior here that's unique for serial columns.…
Let's go ahead and insert some rows here, and you will notice that these inserts…are only inserting two columns: animal and sound.…They're not inserting any value at all in the ID column.…
- 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
PHP with MySQL Beyond the Basicswith Kevin Skoglund10h 26m Intermediate
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.