Table creation/Postal addresses: Difference between revisions

Content added Content deleted
m (added whitespace before the TOC (table of contents), added a ;Task: (bold) header, added other whitespace to the task's preamble.)
(→‎{{header|Perl 6}}: Add a Perl 6 example)
Line 641: Line 641:


This example uses mysql, but DBI supports a extensive list of database drivers. See [http://dbi.perl.org/ dbi.perl.org] for more info.
This example uses mysql, but DBI supports a extensive list of database drivers. See [http://dbi.perl.org/ dbi.perl.org] for more info.

=={{header|Perl 6}}==
{{works with|Rakudo|2017.09}}

Like Perl DBI, Perl 6 DBIish supports many different databases. An example using SQLite is shown here.

<lang perl6>use DBIish;

my $dbh = DBIish.connect('SQLite', :database<addresses.sqlite3>);

my $sth = $dbh.do(q:to/STATEMENT/);
CREATE TABLE Address (
addrID INTEGER PRIMARY KEY AUTOINCREMENT,
addrStreet TEXT NOT NULL,
addrCity TEXT NOT NULL,
addrState TEXT NOT NULL,
addrZIP TEXT NOT NULL
)
STATEMENT</lang>


=={{header|PHP}}+SQLite==
=={{header|PHP}}+SQLite==