Starting test.. battery1 
*************************************************************
0. drop old tables that may be lying around.. and set up tables
drop table auctionitems

drop table sellers

drop table _sequences

select * into _sequences table from originals/_sequences

shsql:  155: warning: destination table doesn't exist.. creating it (_sequences)
*************************************************************
1. create table
CREATE TABLE auctionitems 
	(id, item_title, current_price, nbids, high_bidder, seller, status, _locktime, _lockowner)

table auctionitems created in directory /home/scg/quisp/sqlexampledb/data
*************************************************************
2. tabdef(1) 
'auctionitems' has these fields:
 1. id
 2. item_title
 3. current_price
 4. nbids
 5. high_bidder
 6. seller
 7. status
 8. _locktime
 9. _lockowner
No indexes.
*************************************************************
3. populate the table by selecting into from original copy..
select * into auctionitems table from originals/auctionitems

*************************************************************
4. record count
select count(*) from auctionitems

__rowcount 
---------- 
150        
*************************************************************
5. drop the table
DROP TABLE auctionitems

table auctionitems removed from database and put in recycle bin (/home/scg/quisp/sqlexampledb/tmp)


*************************************************************
6. create the table again by doing a direct 'select into'..
SELECT * INTO auctionitems TABLE FROM originals/auctionitems

shsql:  155: warning: destination table doesn't exist.. creating it (auctionitems)
*************************************************************
7. test ALTER, and use it to add _locktime and _lockowner columns..
ALTER TABLE auctionitems ADD throwaway 

:  404: Note: starting ALTER TABLE auctionitems ADD throwaway 
moving temp table into place...
:  405: Note: ALTER TABLE finished (auctionitems)
alter table auctionitems add _locktime 

:  404: Note: starting ALTER TABLE auctionitems add _locktime 
moving temp table into place...
:  405: Note: ALTER TABLE finished (auctionitems)
alter table auctionitems add _lockowner 

:  404: Note: starting ALTER TABLE auctionitems add _lockowner 
moving temp table into place...
:  405: Note: ALTER TABLE finished (auctionitems)
alter table auctionitems DROP COLUMN throwaway 

:  404: Note: starting ALTER TABLE auctionitems DROP throwaway 
moving temp table into place...
:  405: Note: ALTER TABLE finished (auctionitems)
*************************************************************
8. create indexes..
create index (later) on auctionitems ( current_price order=num, nbids order=num, high_bidder, seller )

Index(es) to be built LATER via a 'create index' or 'maintain' command


CREATE INDEX (TYPE=WORD) ON auctionitems ( item_title )

tabmaint:  400: Note: table maintance starting. (auctionitems)
..building index on auctionitems current_price ..  standardindex(num):1  standardindex(num):2  
..building index on auctionitems high_bidder ..  standardindex:1  standardindex:2  
..building index on auctionitems item_title ..  wordindex:1  wordindex:2  
..building index on auctionitems nbids ..  standardindex(num):1  standardindex(num):2  
..building index on auctionitems seller ..  standardindex:1  standardindex:2  
tabmaint:  401: Note: table maintenance finished. (auctionitems)


*************************************************************
****  retrievals  *******************************************
*************************************************************
10. basic select
select * from auctionitems where nbids > 8 order by id

id                     item_title                  current_price nbids high_bidder seller status _locktime _lockowner 
----- -------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
37007 Original Modern Art Abstract Painting Miller     16.00      11      harv      s01    null    null       null    
37040 MARY'S HENHOUSE CHICKEN PAINTING EGGS MINT!      15.50      13      marv      s22    null    null       null    
37057  SLUMBER PARTY, Abstract Art Painting, NR        16.02      10      walt      s22    null    null       null    
37117        Tole Painting Books - Lot of 4            21.00       9     maureen    s34    null    null       null    
*************************************************************
11. basic select
select * from auctionitems where nbids >= 8 order by id

id                     item_title                  current_price nbids high_bidder seller status _locktime _lockowner 
----- -------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
37007 Original Modern Art Abstract Painting Miller     16.00      11      harv      s01    null    null       null    
37013   moe! Bad Bear MINI painting pop art #196       9.99        8       sam      s01    null    null       null    
37031  OVAL REVERSE PAINTING of GLEN CAIRN CASTLE      26.00       8      jim2      s08    null    null       null    
37040 MARY'S HENHOUSE CHICKEN PAINTING EGGS MINT!      15.50      13      marv      s22    null    null       null    
37057  SLUMBER PARTY, Abstract Art Painting, NR        16.02      10      walt      s22    null    null       null    
37117        Tole Painting Books - Lot of 4            21.00       9     maureen    s34    null    null       null    
37121   painting print witch halloween wicca cat       11.00       8       liz      s34    null    null       null    
*************************************************************
12. select with OR
select * from auctionitems where nbids > 8 OR current_price > 100.00 order by id

id                     item_title                  current_price nbids high_bidder seller status _locktime _lockowner 
----- -------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
37007 Original Modern Art Abstract Painting Miller     16.00      11      harv      s01    null    null       null    
37010  MIAMI Abstract Art Modern Painting Cubist      343.00     null     null      s01    null    null       null    
37040 MARY'S HENHOUSE CHICKEN PAINTING EGGS MINT!      15.50      13      marv      s22    null    null       null    
37057  SLUMBER PARTY, Abstract Art Painting, NR        16.02      10      walt      s22    null    null       null    
37073          Pierre Cornu Nude Painting             500.00     null     null      s17    null    null       null    
37077    Original Fish Art Watercolor Painting        200.00     null     null      s17    null    null       null    
37102    STEAMBOAT HARBOR~Oil Painting~16 X 20        400.00       2      brett     s34    null    null       null    
37117        Tole Painting Books - Lot of 4            21.00       9     maureen    s34    null    null       null    
37135 EXQUISITE EARLY CHINESE WATERCOLOR PAINTING     150.00     null     null      s04    null    null       null    
37139  Irish Oil Painting Maghera Co Down G Walby     127.69       6       cal      s04    null    null       null    
37153 EXQUISITE EARLY CHINESE WATERCOLOR PAINTING     150.00     null     null      s04    null    null       null    
*************************************************************
13. select  - test null v/v inrange numeric comparison
select * from auctionitems where nbids inrange 3,4 order by id

id                     item_title                   current_price nbids high_bidder seller status _locktime _lockowner 
----- --------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
37034 Chinese Painting bird hold in mouth a cicada      12.61       3     connie     s08    null    null       null    
37046 Sunset Paris Eiffel Tower~Oil Painting~16X12      1.50        3      hans      s22    null    null       null    
37051    The Secret Garden~Oil Painting~16 X 12         1.96        3      walt      s22    null    null       null    
37063        Tole Painting Books - Lot of 4             6.57        4       max      s22    null    null       null    
37079 STRUGGLE, Abstract Expressionism Painting, NR     4.77        4     steve2     s17    null    null       null    
37090   OVAL REVERSE PAINTING of MEDIEVAL CASTLE        15.51       3     martha     s34    null    null       null    
37094  GUILTY, Abstract Expressionism Painting, NR      3.27        3       ann      s34    null    null       null    
37100    Fabulous Victorian Floral Oil Painting         51.00       4      paivi     s34    null    null       null    
37113  Japanese painting WILLOW IN THE RAIN sumi-e      51.01       3      pete      s34    null    null       null    
37122   WEST Abstract Art Painting Taylor HUGE NR       5.50        4      brett     s34    null    null       null    
37129      95 Page Folk Art Tole Painting Book          4.01        3      chuck     s04    null    null       null    
*************************************************************
14. select  - test null v/v outrange numeric comparison
select * from auctionitems where nbids outrange 2,5 and current_price > 50.00 order by id

id                     item_title                  current_price nbids high_bidder seller status _locktime _lockowner 
----- -------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
37067 Albert von Keller Original Oil Painting 1903    100.00       1      brett     s22    null    null       null    
37088  WONDERFUL OIL PAINTING LEWANDOWSKI LISTED       74.50       1      neil      s34    null    null       null    
37139  Irish Oil Painting Maghera Co Down G Walby     127.69       6       cal      s04    null    null       null    
*************************************************************
15. select - group by, no where clause
select seller, count(*) from auctionitems group by seller

seller __rowcount 
------ ---------- 
s01        19     
s04        32     
s08        16     
s17        15     
s22        35     
s34        33     
*************************************************************
16. select - group by w/ where clause
SELECT seller, COUNT(*) FROM auctionitems GROUP BY seller WHERE nbids > 5

seller __rowcount 
------ ---------- 
s01        3      
s04        3      
s08        1      
s22        3      
s34        3      
*************************************************************
17. select - isnot null
select * from auctionitems where seller = 's08' and nbids isnot null order by id

id                     item_title                   current_price nbids high_bidder seller status _locktime _lockowner 
----- --------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
37024     Oil Painting Paris Ave signed 20"X24"         0.01        1      glenn     s08    null    null       null    
37026 Chinese Painting birds & cherry---LI TONGYUAN     10.96       2      walt      s08    null    null       null    
37030  3m dual cartridge respirator paint painting      10.99       1       bob      s08    null    null       null    
37031  OVAL REVERSE PAINTING of GLEN CAIRN CASTLE       26.00       8      jim2      s08    null    null       null    
37032        Tole Painting Books - Lot of 4             4.00        1      craig     s08    null    null       null    
37034 Chinese Painting bird hold in mouth a cicada      12.61       3     connie     s08    null    null       null    
37035  Dolphins Under The Sea~Oil Painting~8 X 10       5.50        5      fran      s08    null    null       null    
37036     VIBRANT Abstract~Oil Painting~12 X 16         1.00        1      greg      s08    null    null       null    
*************************************************************
18. select - contains
select *, _matchscore from auctionitems 
	where item_title contains 'ital naples' order by _matchscore, id

id                     item_title                  current_price nbids high_bidder seller status _locktime _lockowner _matchscore 
----- -------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- ----------- 
37069  Pretty Port of Naples Italian Oil Painting      35.00     null     null      s22    null    null       null        02      
37056   Eye-catching Italian Forest Oil Painting       20.00     null     null      s22    null    null       null        06      
37061 Pretty Italian Mountain Cottage Oil Painting     25.00     null     null      s22    null    null       null        06      
37066  Gorgeous Ship in Port Italian Oil Painting      10.00     null     null      s22    null    null       null        06      
37087   Beautiful Sea View Italian Oil Painting        15.00     null     null      s17    null    null       null        06      
*************************************************************
19. select - contains w/ OR
select *, _matchscore from auctionitems 
	where item_title contains 'nude woman' 
		OR item_title contains 'nude female' order by _matchscore, id 

id                     item_title                   current_price nbids high_bidder seller status _locktime _lockowner _matchscore 
----- --------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- ----------- 
37015    Nude Woman Asian Chinese 36x24 PAINTING        49.99       1      jane      s01    null    null       null        05      
37022     Semi Nude Woman 36x24 OIL PAINTING NR         49.99     null     null      s08    null    null       null        05      
37120          SPICEY FEMALE NUDE PAINTING              37.50       1       joe      s34    null    null       null        06      
37002 Modern Nude Abstract Painting Original Art RK     4.99        1       jim      s01    null    null       null        10      
37073          Pierre Cornu Nude Painting              500.00     null     null      s17    null    null       null        10      
37110 Original Nude Minority of China Oil Painting      85.15     null     null      s34    null    null       null        10      
37038    Oil Painting Woman On the beach 20"X24"        0.01      null     null      s22    null    null       null        25      
*************************************************************
20. select - count() on a field with some null
select count(nbids) from auctionitems

nbids__count 
------------ 
70           
*************************************************************
21. select - min() and max() on nbids field 
select min(nbids), max(nbids) from auctionitems

nbids__min nbids__max 
---------- ---------- 
1              13     
*************************************************************
22. select - min() and max() on nbids field w/ group by 
select seller, MIN(nbids), MAX(nbids) FROM auctionitems GROUP BY seller

seller nbids__min nbids__max 
------ ---------- ---------- 
s01        1          11     
s04        1          7      
s08        1          8      
s17        1          5      
s22        1          13     
s34        1          9      
*************************************************************
23. select - avg() and sum() on nbids field w/ group by 
select seller, avg(current_price), sum(current_price) from auctionitems group by seller

seller current_price__avg current_price__sum 
------ ------------------ ------------------ 
s01         37.6042             714.48       
s04         24.2006             774.42       
s08         19.8119             316.99       
s17         57.5647             863.47       
s22         14.0779             478.65       
s34         28.4109             937.56       
*************************************************************
24. select - IN w/ degenerate commalist
select * from auctionitems where high_bidder in ',,liz,,martha,kelly,,'

id                   item_title                current_price nbids high_bidder seller status _locktime _lockowner 
----- ---------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
37018  OLD WATERCOLOUR PAINTING 3 CAT STUDIES      6.00        6      kelly     s01    null    null       null    
37090 OVAL REVERSE PAINTING of MEDIEVAL CASTLE     15.51       3     martha     s34    null    null       null    
37121 painting print witch halloween wicca cat     11.00       8       liz      s34    null    null       null    
*************************************************************
*** updates section *****************************************
*************************************************************

30. create sequence
create sequence on auctionitems

select _sequence from auctionitems

value 
----- 
1     
*************************************************************
31. set sequence number to an initial value of 38000
update _sequences set value = 38000 where tablename = 'auctionitems' 

*************************************************************
32. get next sequence number
got 38001	
*************************************************************
33. insert a new row - certain fields, fieldnames given
insert into auctionitems (id, item_title, current_price, seller)
	values (38001	, 'Painting, Broadway Boogie-Woogie, Study by Gio Vivian', 40.00, 's19' )

select * from auctionitems where id = 38001	

id                         item_title                       current_price nbids high_bidder seller status _locktime _lockowner 
----- ----------------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
38001 Painting, Broadway Boogie-Woogie, Study by Gio Vivian     40.00     null     null      s19    null    null       null    
*************************************************************
34. insert a new row - all fields, no fieldnames given
got 38002	
insert into auctionitems 
	values ( 38002	, 'Painting, Blueberry hill, Maine, F Stanley', 35.00, 
	null, null, 's19', null, null, null )

select * from auctionitems where id = 38002	

id                    item_title                 current_price nbids high_bidder seller status _locktime _lockowner 
----- ------------------------------------------ ------------- ----- ----------- ------ ------ --------- ---------- 
38002 Painting, Blueberry hill, Maine, F Stanley     35.00     null     null      s19    null    null       null    
*************************************************************
35. use 'update .. orinsert' to insert another new row
got 38003	
select * from auctionitems where id = 38003	

id    item_title current_price nbids high_bidder seller status _locktime _lockowner 
----- ---------- ------------- ----- ----------- ------ ------ --------- ---------- 
38003    city        35.00     null     null      s19    null    null       null    
*************************************************************
36. insert 2 new rows having weird characters
got 38004	
insert into auctionitems (id, item_title, current_price, seller)
	values (38004	, '$discount$ painting / art supplies', 10.00, 's19' )

got 38005	
insert into auctionitems (id, item_title, current_price, seller)
	values (38005	, '@discount@ 
	painting / art supplies', 10.00, 's19' )

*************************************************************
37. retrieve the weird character entries by name
select * from auctionitems where item_title inlike '$*,@*' order by id

id                    item_title                 current_price nbids high_bidder seller status _locktime _lockowner 
----- ------------------------------------------ ------------- ----- ----------- ------ ------ --------- ---------- 
37039 @JJ Star Painting Angel on Moon Pin - Rare     8.99      null     null      s22    null    null       null    
38004     $discount$ painting / art supplies         10.00     null     null      s19    null    null       null    
38005    @discount@   painting / art supplies        10.00     null     null      s19    null    null       null    
*************************************************************
38. update the 'city' record, each time one character longer, to test upd cutover
update auctionitems set item_title = 'city scene1' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene1	
update auctionitems set item_title = 'city scene12' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene12	
update auctionitems set item_title = 'city scene123' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123	
update auctionitems set item_title = 'city scene1234' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene1234	
update auctionitems set item_title = 'city scene12345' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene12345	
update auctionitems set item_title = 'city scene123456' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456	
update auctionitems set item_title = 'city scene1234567' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene1234567	
update auctionitems set item_title = 'city scene12345678' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene12345678	
update auctionitems set item_title = 'city scene123456789' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456789	
update auctionitems set item_title = 'city scene123456789A' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456789A	
update auctionitems set item_title = 'city scene123456789AB' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456789AB	
update auctionitems set item_title = 'city scene123456789ABC' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456789ABC	
update auctionitems set item_title = 'city scene123456789ABCD' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456789ABCD	
update auctionitems set item_title = 'city scene123456789ABCDE' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456789ABCDE	
update auctionitems set item_title = 'city scene123456789ABCDEF' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456789ABCDEF	
update auctionitems set item_title = 'city scene123456789ABCDEFG' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456789ABCDEFG	
update auctionitems set item_title = 'city scene123456789ABCDEFGH' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456789ABCDEFGH	
update auctionitems set item_title = 'city scene123456789ABCDEFGHI' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456789ABCDEFGHI	
update auctionitems set item_title = 'city scene123456789ABCDEFGHIJ' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456789ABCDEFGHIJ	
update auctionitems set item_title = 'city scene123456789ABCDEFGHIJK' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456789ABCDEFGHIJK	
update auctionitems set item_title = 'city scene123456789ABCDEFGHIJKL' where id = 38003	

select item_title from auctionitems where id = 38003	

city scene123456789ABCDEFGHIJKL	
update auctionitems set item_title = 'city scene123456789ABCDEFGHIJKLM' where id = 38003	

select item_title from auctionitems where id = 38003	

item_title                       
-------------------------------- 
city scene123456789ABCDEFGHIJKLM 
select * from auctionitems where seller = 's19'

id                         item_title                       current_price nbids high_bidder seller status _locktime _lockowner 
----- ----------------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
38001 Painting, Broadway Boogie-Woogie, Study by Gio Vivian     40.00     null     null      s19    null    null       null    
38002      Painting, Blueberry hill, Maine, F Stanley           35.00     null     null      s19    null    null       null    
38004          $discount$ painting / art supplies               10.00     null     null      s19    null    null       null    
38005         @discount@   painting / art supplies              10.00     null     null      s19    null    null       null    
38003           city scene123456789ABCDEFGHIJKLM                35.00     null     null      s19    null    null       null    
*************************************************************
39. use 'update .. orinsert' to update the row we just added above..
update auctionitems ORINSERT
		set id = 38003	, item_title = 'city scene, kingston, jamaica, 1908',
		seller = 's19', current_price = 35.00
		where id = 38003	

select * from auctionitems where id = 38003	

id                item_title              current_price nbids high_bidder seller status _locktime _lockowner 
----- ----------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
38003 city scene, kingston, jamaica, 1908     35.00     null     null      s19    null    null       null    
*************************************************************
40. update all records for seller 's19'
update auctionitems set status = 'P' where seller = 's19'

select * from auctionitems where seller = 's19' order by id

id                         item_title                       current_price nbids high_bidder seller status _locktime _lockowner 
----- ----------------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
38001 Painting, Broadway Boogie-Woogie, Study by Gio Vivian     40.00     null     null      s19     P      null       null    
38002      Painting, Blueberry hill, Maine, F Stanley           35.00     null     null      s19     P      null       null    
38003          city scene, kingston, jamaica, 1908              35.00     null     null      s19     P      null       null    
38004          $discount$ painting / art supplies               10.00     null     null      s19     P      null       null    
38005         @discount@   painting / art supplies              10.00     null     null      s19     P      null       null    
*************************************************************
***  Record locking  ****************************************
*************************************************************
50. select for update (set record lock) - single record
select * from auctionitems where id = 37044   FOR UPDATE

id                item_title             current_price nbids high_bidder seller status _locktime _lockowner 
----- ---------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
37044 Paris Capital~Oil Painting~16 X 12     1.00      null     null      s22    null    null       null    
*************************************************************
51. another user attempts to set record lock for same record - fails 
select * from auctionitems where id = 37044   FOR UPDATE

shsql: record is locked and currently unavailable for update (command: select * from auctionitems where id = 37044   FOR UPDATE)
id item_title current_price nbids high_bidder seller status _locktime _lockowner 
-- ---------- ------------- ----- ----------- ------ ------ --------- ---------- 
*************************************************************
52. original user updates record - clears lock
update auctionitems 
		set nbids = 1, current_price = 3.00, high_bidder = 'steve' 
		where id = 37044

*************************************************************
53. other user can now gain record lock - success
select * from auctionitems where id = 37044   FOR UPDATE

id                item_title             current_price nbids high_bidder seller status _locktime _lockowner 
----- ---------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
37044 Paris Capital~Oil Painting~16 X 12     3.00        1      steve     s22    null    null      steve    
*************************************************************
54. locking user eventually updates even tho the lock has timed out.. - success,
since no other user has locked record in the meantime
update auctionitems set _locktime = '00000' where id = 37044

update auctionitems 
		set nbids = 2, current_price = 5.00, high_bidder = 'fred' 
		where id = 37044

*************************************************************
55. lock has timed out and another user wants the lock.. - success
update auctionitems set _lockowner = 'fred', _locktime = '00000' where id = 37044

select * from auctionitems where id = 37044   FOR UPDATE

id                item_title             current_price nbids high_bidder seller status _locktime _lockowner 
----- ---------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
37044 Paris Capital~Oil Painting~16 X 12     5.00        2      fred      s22    null    00000      fred    
*************************************************************
56. multi-row record lock..
Note that record 37044 was not locked because lock already held by steve..
select id, _lockowner from auctionitems where seller = 's22' order by id

id    _lockowner 
----- ---------- 
37037    s22     
37038    s22     
37039    s22     
37040    s22     
37041    s22     
37042    s22     
37043    s22     
37044   steve    
37045    s22     
37046    s22     
37047    s22     
37048    s22     
37049    s22     
37050    s22     
37051    s22     
37053    s22     
37054    s22     
37055    s22     
37056    s22     
37057    s22     
37058    s22     
37059    s22     
37060    s22     
37061    s22     
37062    s22     
37063    s22     
37064    s22     
37065    s22     
37066    s22     
37067    s22     
37068    s22     
37069    s22     
37070    s22     
37071    s22     
37072    s22     
*************************************************************
57. update all the locked records.. 37044 will not be updated and there will 
be a 'record is locked' msg.. 
update auctionitems set status = 'H' where seller = 's22'

shsql: record is locked and currently unavailable for update (command: update auctionitems set status = 'H' where seller = 's22')
select id, status, _lockowner from auctionitems where seller = 's22' order by id

id    status _lockowner 
----- ------ ---------- 
37037   H       s22     
37038   H       s22     
37039   H       s22     
37040   H       s22     
37041   H       s22     
37042   H       s22     
37043   H       s22     
37044  null    steve    
37045   H       s22     
37046   H       s22     
37047   H       s22     
37048   H       s22     
37049   H       s22     
37050   H       s22     
37051   H       s22     
37053   H       s22     
37054   H       s22     
37055   H       s22     
37056   H       s22     
37057   H       s22     
37058   H       s22     
37059   H       s22     
37060   H       s22     
37061   H       s22     
37062   H       s22     
37063   H       s22     
37064   H       s22     
37065   H       s22     
37066   H       s22     
37067   H       s22     
37068   H       s22     
37069   H       s22     
37070   H       s22     
37071   H       s22     
37072   H       s22     
*************************************************************
58. lock the same record set again, this time delete the records.. 37044 will 
not be deleted and there will be a 'record is locked' msg.. 
delete from auctionitems where seller = 's22'

shsql: record is locked and currently unavailable for update (command: delete from auctionitems where seller = 's22')
select id, status, _lockowner from auctionitems where seller = 's22' order by id

id    status _lockowner 
----- ------ ---------- 
37044  null    steve    
*************************************************************
59. fake it so the lock on 37044 is timed out, and try the lock/delete again.. should do it this time..
update auctionitems set _locktime = '00000' where id = 37044

delete from auctionitems where seller = 's22'

select id, status, _lockowner from auctionitems where seller = 's22' order by id

id status _lockowner 
-- ------ ---------- 
*************************************************************
****  joins  ************************************************
*************************************************************
70. join test.. first make a file with seller info..
create table sellers ( id, fullname )

table sellers created in directory /home/scg/quisp/sqlexampledb/data
insert into sellers ( id, fullname ) values ( 's01', 'Marcus Sales Co.' )

INSERT INTO sellers ( id, fullname ) VALUES ( 's04', 'Worthington\'s' )

insert into sellers ( id, fullname ) values ( 's08', 'Class Act II' )

insert into sellers ( id, fullname ) values ( 's17', 'John M. Havlicharcz and Sons' )

insert into sellers ( id, fullname ) values ( 's22', 'Arts and Farces Inc.' )

insert into sellers ( id, fullname ) values ( 's19', 'Bleeker and Blum Auctioneers, Tremont, Maine' )

select * from sellers order by fullname

id                    fullname                   
--- -------------------------------------------- 
s22             Arts and Farces Inc.             
s19 Bleeker and Blum Auctioneers, Tremont, Maine 
s08                 Class Act II                 
s17         John M. Havlicharcz and Sons         
s01               Marcus Sales Co.               
s04                Worthington's                 
*************************************************************
71. retrieve the records we should be seeing later..
select * from auctionitems where current_price >= 50.00 and nbids > 0 order by current_price num desc, id

id                     item_title                   current_price nbids high_bidder seller status _locktime _lockowner 
----- --------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
37102     STEAMBOAT HARBOR~Oil Painting~16 X 20        400.00       2      brett     s34    null    null       null    
37139  Irish Oil Painting Maghera Co Down G Walby      127.69       6       cal      s04    null    null       null    
37088  WONDERFUL OIL PAINTING LEWANDOWSKI LISTED        74.50       1      neil      s34    null    null       null    
37113  Japanese painting WILLOW IN THE RAIN sumi-e      51.01       3      pete      s34    null    null       null    
37004 FOLK ART PAINTING~MAN IN THE MOON BOWL AUTUMN     51.00       5      terry     s01    null    null       null    
37100    Fabulous Victorian Floral Oil Painting         51.00       4      paivi     s34    null    null       null    
37143 Portrait painting on ivory, Blue Boy, British     50.00       1      alvin     s04    null    null       null    
37150 Portrait painting, ivory,Madame Lebrun,France     50.00       1      walt      s04    null    null       null    
*************************************************************
72. inner join - note the order of tables in the JOIN clause for proper duplicate key handling..
select a.item_title, s.fullname, a.current_price
	from sellers (as s) join auctionitems (as a) on s.id = a.seller 
	where a.current_price >= 50.00 and a.nbids > 0
	order by a.current_price num desc, a.id

a.item_title                                     s.fullname    a.current_price 
--------------------------------------------- ---------------- --------------- 
Irish Oil Painting Maghera Co Down G Walby     Worthington's       127.69      
FOLK ART PAINTING~MAN IN THE MOON BOWL AUTUMN Marcus Sales Co.      51.00      
Portrait painting on ivory, Blue Boy, British  Worthington's        50.00      
Portrait painting, ivory,Madame Lebrun,France  Worthington's        50.00      
*************************************************************
73. left join, w/ syntax variation
SELECT a.item_title, s.fullname, a.current_price
	FROM auctionitems = a LEFTDL JOIN sellers = s 
	ON a.seller = s.id 
	WHERE a.current_price >= 50.00 AND a.nbids > 0
	ORDER BY a.current_price num desc, a.id

a.item_title                                     s.fullname    a.current_price 
--------------------------------------------- ---------------- --------------- 
STEAMBOAT HARBOR~Oil Painting~16 X 20               null           400.00      
Irish Oil Painting Maghera Co Down G Walby     Worthington's       127.69      
WONDERFUL OIL PAINTING LEWANDOWSKI LISTED           null            74.50      
Japanese painting WILLOW IN THE RAIN sumi-e         null            51.01      
FOLK ART PAINTING~MAN IN THE MOON BOWL AUTUMN Marcus Sales Co.      51.00      
Fabulous Victorian Floral Oil Painting              null            51.00      
Portrait painting on ivory, Blue Boy, British  Worthington's        50.00      
Portrait painting, ivory,Madame Lebrun,France  Worthington's        50.00      
*************************************************************
74. right join, note order of tables in the JOIN clause for proper duplicate key handling
SELECT a.item_title, s.fullname, a.current_price
	FROM sellers = s RIGHT JOIN auctionitems = a 
	ON a.seller = s.id 
	WHERE a.current_price >= 50.00 AND a.nbids > 0
	ORDER BY a.current_price num desc, a.id

a.item_title                                     s.fullname    a.current_price 
--------------------------------------------- ---------------- --------------- 
STEAMBOAT HARBOR~Oil Painting~16 X 20               null           400.00      
Irish Oil Painting Maghera Co Down G Walby     Worthington's       127.69      
WONDERFUL OIL PAINTING LEWANDOWSKI LISTED           null            74.50      
Japanese painting WILLOW IN THE RAIN sumi-e         null            51.01      
FOLK ART PAINTING~MAN IN THE MOON BOWL AUTUMN Marcus Sales Co.      51.00      
Fabulous Victorian Floral Oil Painting              null            51.00      
Portrait painting on ivory, Blue Boy, British  Worthington's        50.00      
Portrait painting, ivory,Madame Lebrun,France  Worthington's        50.00      
*************************************************************
*****   misc   **********************************************
*************************************************************
80. select into temp table..
select * into $tmp1 from auctionitems where seller = 's19' order by id

select * from $tmp1

id                         item_title                       current_price nbids high_bidder seller status _locktime _lockowner 
----- ----------------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
38001 Painting, Broadway Boogie-Woogie, Study by Gio Vivian     40.00     null     null      s19     P      null       null    
38002      Painting, Blueberry hill, Maine, F Stanley           35.00     null     null      s19     P      null       null    
38003          city scene, kingston, jamaica, 1908              35.00     null     null      s19     P      null       null    
38004          $discount$ painting / art supplies               10.00     null     null      s19     P      null       null    
38005         @discount@   painting / art supplies              10.00     null     null      s19     P      null       null    
*************************************************************
81. select from two tables.. 
select * from auctionitems and $tmp1 where seller = 's19' and item_title like 'paint*'

id                         item_title                       current_price nbids high_bidder seller status _locktime _lockowner 
----- ----------------------------------------------------- ------------- ----- ----------- ------ ------ --------- ---------- 
38001 Painting, Broadway Boogie-Woogie, Study by Gio Vivian     40.00     null     null      s19     P      null       null    
38002      Painting, Blueberry hill, Maine, F Stanley           35.00     null     null      s19     P      null       null    
38001 Painting, Broadway Boogie-Woogie, Study by Gio Vivian     40.00     null     null      s19     P      null       null    
38002      Painting, Blueberry hill, Maine, F Stanley           35.00     null     null      s19     P      null       null    
*************************************************************
82. test DATAEDIT ..
this command will be invoked: sleep 2
dataedit:  402: Note: dataedit starting (auctionitems)
dataedit:  403: Note: dataedit finished (auctionitems)
*************************************************************
83. run MAINTAIN to remove blank lines from table, and rebuild indexes..
maintain auctionitems

tabmaint:  400: Note: table maintance starting. (auctionitems)
..table file has been cleaned (60 records removed).. now has 121 rows
..building index on auctionitems current_price ..  standardindex(num):1  standardindex(num):2  
..building index on auctionitems high_bidder ..  standardindex:1  standardindex:2  
..building index on auctionitems item_title ..  wordindex:1  wordindex:2  
..building index on auctionitems nbids ..  standardindex(num):1  standardindex(num):2  
..building index on auctionitems seller ..  standardindex:1  standardindex:2  
tabmaint:  401: Note: table maintenance finished. (auctionitems)
