Counting rows is accomplished with the COUNT() function. The special case COUNT(*) function, with an asterisk, counts all rows.
- [Instructor] Use the count function … to count rows instead of listing them. … Here again, we're going to use the world database, … and I'm just going to type a little select statement … here, select count, … and in parenthesis I'll put an asterisk, … from country, and when I execute this using F9, … you see that I get a count, … I get one row, and that one row has the number 239 in it, … which represents the count of the number of rows … in the country table. … Now if I want to, I can use a where clause, … that I can limit the number of rows that are counted, … I can say … where, … population, is greater than, … one million, … and when I execute this I now just get 154 rows, … and if I say 100 million, … add a couple more zeros on this, … see I get just 10 rows, … and if I say and, … continent … equals Europe, … now I get just one row. … So it's worth noting that the asterisk … is a special case. … The asterisk means count all the rows, … and so when I execute this, I get the whole 239, …
This course was created by Bill Weinman. We are pleased to offer this training in our library.
- How databases are organized
- Selecting rows and columns
- Creating new tables
- Inserting and updating data
- Sorting and filtering
- Accessing related tables with JOIN
- Working with strings
- Understanding numeric types
- Using aggregate functions and transactions
- Automating data with triggers
- Creating views
- Using CRUD functions
Skill Level Beginner
2. SQL Overview
3. Fundamental Concepts
7. Dates and Times
Dates and times2m 6s
11. Views and Subselects
12. A Simple CRUD Application
- 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.