…When a new row is inserted into a table in a…relational database, you often need to know the value of the…id column for the new row so that it can be…used in another table or for interactive forums or other purposes.…MySQL provides a function called last insert id that…provides the most recently generated value of an auto-increment column.…For example, here in this insert album SQL function you…notice we have this simple query inserted into the album.…The question marks are for the parameters and those parameters are filled in here in…the execute call with title artist, label, and released.…
And then down here there's a call to lastInsertId.…It has a slightly different form for the.…Postgress database but it gets the last inserted ID.…It'll get the ID of this column after…it's been inserted into the database and that's returned.…It's eventually used in this album edit, function up here.…Which gets past that ID for building the Album Edit form.…And so, if I come out here to the…application and I insert a new album, 1 January 2014.…
Author
Released
5/14/2014- Writing queries
- Creating and updating databases and tables
- Using MySQL built-in functions
- Sorting and filtering data
- Updating tables with triggers
- Working with subselects and views
- Creating and using a stored function
Skill Level Beginner
Duration
Views
Related Courses
-
Learning MySQL Development (2014)
with Sheeri Cabral2h 57m Beginner
-
Introduction
-
Welcome1m
-
Using the exercise files1m 31s
-
What is MySQL?1m 48s
-
-
1. Installing and Configuring the Test Environment
-
Installation overview3m 16s
-
Installing XAMPP on Windows5m 55s
-
Installing XAMPP on the Mac6m 38s
-
Setting up MySQL users11m 31s
-
Installing SID on Windows5m 43s
-
-
2. Basic Syntax
-
The SELECT statement3m 57s
-
Selecting rows4m 57s
-
Selecting columns3m 8s
-
Filtering results with WHERE3m 52s
-
Inserting rows4m 9s
-
Updating rows2m 21s
-
Deleting rows2m 25s
-
Literal strings3m 11s
-
Understanding NULL2m 42s
-
-
3. Creating a Database
-
Creating a database4m 30s
-
Creating a table7m 18s
-
Creating indexes6m 8s
-
Creating an ID column6m 58s
-
Altering a table4m 9s
-
-
4. MySQL Data Types
-
What are data types?4m 1s
-
Numeric types5m 20s
-
String types2m 58s
-
Date and time types7m 2s
-
Bit type2m 26s
-
Boolean values2m 15s
-
Enumeration types4m 53s
-
-
5. MySQL Functions
-
String functions6m 57s
-
Numeric functions6m 2s
-
Date and time functions4m 12s
-
Time zones in MySQL3m 37s
-
Formatting dates1m 51s
-
Aggregate functions5m 45s
-
Flow control with CASE4m 9s
-
-
6. Transactions
-
7. Triggers
-
8. Subselects and Views
-
Creating a simple subselect3m 22s
-
Creating a view3m 32s
-
Creating a joined view3m 23s
-
-
9. Stored Routines
-
Creating a stored function4m 34s
-
Creating a stored procedure5m 52s
-
10. PHP's PDO Interface with MySQL
-
Executing the SQL4m 8s
-
Using a stored funciton4m 9s
-
Conclusion
-
Goodbye1m 3s
-
- 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.
CancelTake 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.
Share this video
Embed this video
Video: Implementing auto-increment IDs