Join Bill Weinman for an in-depth discussion in this video Creating a view, part of MySQL Essential Training.
…MySQL supports views, so you can save a query as…a view, and use that view like you would a subselect.…This is really very simple.…For this example, we'll use the database.…And here's a useful little query that gets the as minutes and seconds I can say…SELECT ID, album_id, title, track_number.…And duration DIV 60 AS minutes.…
And duration MOD 60 as seconds FROM track.…And when I run this, you'll see we have the entire track table.…And instead of the duration as a number…of seconds we've got it in minutes and seconds.…And that's actually pretty useful.…Now if I know I'm going to use this query a lot, I can save it as a view.…I can simply do this.…I can say CREATE VIEW.…And name it trackView.…
And then here's just an overloading of the as keyword.…As.…And this is the view itself.…I like to put the semicolon on a separate line when I indent like that.…It's just me, it's not necessary.…And now I can say select asterisk FROM TrackView,…as if it were a table, or a sub select.…I press Go.…I've got exactly the same result, but now I have got it as a trackView.…
- 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
PHP with MySQL Essential Trainingwith Kevin Skoglund14h 32m Beginner
1. Installing and Configuring the Test Environment
2. Basic Syntax
3. Creating a Database
4. MySQL Data Types
5. MySQL Functions
8. Subselects and Views
9. Stored Routines
10. PHP's PDO Interface with MySQL
- 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.