Table creation/Postal addresses: Difference between revisions

Added PicoLisp
(added perl)
(Added PicoLisp)
Line 224:
");
?></lang>
 
=={{header|PicoLisp}}==
PicoLisp has built-in database functionality, in the form of
(non-relational) entity/relations, built on top of persistent
objects (so-called external symbols)
 
Define an "address" entity, and create the database:
<lang PicoLisp>(class +Adr +Entity)
(rel nm (+Sn +Idx +String)) # Name [Soundex index]
(rel str (+String)) # Street
(rel zip (+Ref +String)) # ZIP [Non-unique index]
(rel cit (+Fold +Idx +String)) # City [Folded substring index]
(rel st (+String)) # State
(rel tel (+Fold +Ref +String)) # Phone [Folded non-unique index]
(rel em (+Ref +String)) # EMail [Non-unique index]
(rel txt (+Blob)) # Memo
(rel jpg (+Blob)) # Photo
 
(pool "address.db") # Create database</lang>
Create a first entry, and show it:
<lang PicoLisp>(show
(new! '(+Adr) # Create a record
'nm "FSF Inc."
'str "51 Franklin St"
'st "Boston, MA"
'zip "02110-1301" ) )</lang>
Output:
<pre>{2} (+Adr)
zip "02110-1301"
st "Boston, MA"
str "51 Franklin St"
nm "FSF Inc."</pre>
Interactive "select":
<lang PicoLisp>(select nm zip +Adr nm "FSF") # Select name, zip from Adr where name = FSF*</lang>
Output:
<pre>"FSF Inc." "02110-1301" {2}</pre>
 
=={{header|PostgreSQL}}==
Anonymous user