-
1
- #1
vgulielmus
Programmer
This weekend my intention is to show the power of VFP's SQL
Again, these exercises are for fun only
a) Given this cursor
using only SQL SELECT, expand its values to the first 50 integers, e.g
ii
1
2
...
50
b) Given this cursor
e.g.
[pre]ii cc
1 AAA
2 BBB
...
10 JJJ[/pre]
using only SQL SELECT and SQL UPDATE, create a cursor cc2 like this one
[pre]ii cc
1 AAABBBCCCDDDEEEFFFGGGHHHIIIJJJ[/pre]
(like STRING_AGG in Postgress or GROUP_CONCAT in MySQL)
A good explanation
If the generalised solution requires a FOR / WHILE loop, you can use the loop.
But for these particular requests, the commands can be repeated explicitly (with copy / paste)
Respectfully,
Vilhelm-Ion Praisach
Resita, Romania
Again, these exercises are for fun only
a) Given this cursor
Code:
CREATE CURSOR cc (ii I)
INSERT INTO cc VALUES (1)
using only SQL SELECT, expand its values to the first 50 integers, e.g
ii
1
2
...
50
b) Given this cursor
Code:
CREATE CURSOR cc (ii I AUTOINC,cc C(10))
FOR lni = 1 TO 10
INSERT INTO cc (cc) VALUES (REPLICATE(CHR(64+lni),3))
NEXT
[pre]ii cc
1 AAA
2 BBB
...
10 JJJ[/pre]
using only SQL SELECT and SQL UPDATE, create a cursor cc2 like this one
[pre]ii cc
1 AAABBBCCCDDDEEEFFFGGGHHHIIIJJJ[/pre]
(like STRING_AGG in Postgress or GROUP_CONCAT in MySQL)
A good explanation
If the generalised solution requires a FOR / WHILE loop, you can use the loop.
But for these particular requests, the commands can be repeated explicitly (with copy / paste)
Respectfully,
Vilhelm-Ion Praisach
Resita, Romania