Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SELECT with one result

  • SELECT
#!/usr/bin/perl
use strict;
use warnings;

use DBI;

my $dbfile = "sample.db";

my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile");


my $sth = $dbh->prepare('SELECT COUNT(*) FROM people');
$sth->execute;

my ($count) = $sth->fetchrow_array();

print "There are $count number of rows.\n";