Table creation/Postal addresses: Difference between revisions

Added Lua version
m (→‎version 1: changed the wording in the boxed comments, added/changed comments and whitespace, changed indentations of the output, simplified the specification for addresses, used a template for the output.)
(Added Lua version)
Line 426:
Output:
<pre>No error</pre>
 
=={{header|Lua}}==
Using LJSQLite3 - compatible with LuaJIT and supplied in the ULua distribution.
<lang Lua>-- Import module
local sql = require("ljsqlite3")
 
-- Open connection to database file
local conn = sql.open("address.sqlite")
 
-- Create address table unless it already exists
conn:exec[[
CREATE TABLE IF NOT EXISTS address(
id INTEGER PRIMARY KEY AUTOINCREMENT,
street TEXT NOT NULL,
city TEXT NOT NULL,
state TEXT NOT NULL,
zip TEXT NOT NULL)
]]
 
-- Explicitly close connection
conn:close()</lang>
 
=={{header|Mathematica}}==
Anonymous user