fork(1) download
  1. create table z (
  2. A char(10)
  3. );
  4.  
  5. insert into z
  6. values ('##########');
  7.  
  8. create table s (
  9. SNumber char(2) primary key,
  10. Sname char(10),
  11. Sstatus smallint,
  12. City char(10)
  13. );
  14.  
  15. insert into s
  16. values ('S1', 'Smith', 20, 'London');
  17.  
  18. insert into s
  19. values ('S2', 'Jones', 10, 'Paris');
  20.  
  21. insert into s
  22. values ('S3', 'Blake', 30, 'Paris');
  23.  
  24. insert into s
  25. values ('S4', 'Clark', 20, 'London');
  26.  
  27. insert into s
  28. values ('S5', 'Adams', 30, 'Athens');
  29.  
  30. select *
  31. from s;
  32.  
  33. select *
  34. from z;
  35.  
  36. create table p (
  37. PNumber char(2) primary key,
  38. Pname char(10),
  39. Color char(6),
  40. Pweight smallint,
  41. City char(10)
  42. );
  43.  
  44. insert into p
  45. values ('P1', 'Nut', 'Red', 12, 'London');
  46.  
  47. insert into p
  48. values ('P2', 'Bolt', 'Green', 17, 'Paris');
  49.  
  50. insert into p
  51. values ('P3', 'Screw', 'Blue', 17, 'Rome');
  52.  
  53. insert into p
  54. values ('P4', 'Screw', 'Red', 12, 'Paris');
  55.  
  56. insert into p
  57. values ('P5', 'Cam', 'Blue', 12, 'Paris');
  58.  
  59. insert into p
  60. values ('P6', 'Cog', 'Red', 10, 'London');
  61.  
  62. select *
  63. from p;
  64.  
  65. select *
  66. from z;
  67.  
  68. create table sp(
  69. SNumber char(2),
  70. PNumber char(2),
  71. Qty int,
  72. primary key (SNumber, PNumber)
  73. );
  74.  
  75. insert into sp
  76. values ('S1', 'P1', 100);
  77.  
  78. insert into sp
  79. values ('S1', 'P2', 200);
  80.  
  81. insert into sp
  82. values ('S1', 'P3', 150);
  83.  
  84. insert into sp
  85. values ('S1', 'P4', 400);
  86.  
  87. insert into sp
  88. values ('S1', 'P5', 100);
  89.  
  90. insert into sp
  91. values ('S1', 'P6', 300);
  92.  
  93. insert into sp
  94. values ('S2', 'P1', 200);
  95.  
  96. insert into sp
  97. values ('S2', 'P2', 100);
  98.  
  99. insert into sp
  100. values ('S3', 'P2', 100);
  101.  
  102. insert into sp
  103. values ('S4', 'P2', 400);
  104.  
  105. insert into sp
  106. values ('S4', 'P4', 500);
  107.  
  108. insert into sp
  109. values ('S4', 'P5', 200);
  110.  
  111. select *
  112. from sp;
  113.  
  114. select *
  115. from z;
  116.  
  117. select *
  118. from s as sx, s as sy;
  119.  
  120. select s.Sname, s.Sname
  121. from s as sx, s as sy
  122. where sx.City = sy.City
  123.  
  124. select *
  125. from z;
  126.  
  127.  
Runtime error #stdin #stdout 0s 3008KB
stdin
Standard input is empty
stdout
S1|Smith|20|London
S2|Jones|10|Paris
S3|Blake|30|Paris
S4|Clark|20|London
S5|Adams|30|Athens
##########
P1|Nut|Red|12|London
P2|Bolt|Green|17|Paris
P3|Screw|Blue|17|Rome
P4|Screw|Red|12|Paris
P5|Cam|Blue|12|Paris
P6|Cog|Red|10|London
##########
S1|P1|100
S1|P2|200
S1|P3|150
S1|P4|400
S1|P5|100
S1|P6|300
S2|P1|200
S2|P2|100
S3|P2|100
S4|P2|400
S4|P4|500
S4|P5|200
##########
S1|Smith|20|London|S1|Smith|20|London
S1|Smith|20|London|S2|Jones|10|Paris
S1|Smith|20|London|S3|Blake|30|Paris
S1|Smith|20|London|S4|Clark|20|London
S1|Smith|20|London|S5|Adams|30|Athens
S2|Jones|10|Paris|S1|Smith|20|London
S2|Jones|10|Paris|S2|Jones|10|Paris
S2|Jones|10|Paris|S3|Blake|30|Paris
S2|Jones|10|Paris|S4|Clark|20|London
S2|Jones|10|Paris|S5|Adams|30|Athens
S3|Blake|30|Paris|S1|Smith|20|London
S3|Blake|30|Paris|S2|Jones|10|Paris
S3|Blake|30|Paris|S3|Blake|30|Paris
S3|Blake|30|Paris|S4|Clark|20|London
S3|Blake|30|Paris|S5|Adams|30|Athens
S4|Clark|20|London|S1|Smith|20|London
S4|Clark|20|London|S2|Jones|10|Paris
S4|Clark|20|London|S3|Blake|30|Paris
S4|Clark|20|London|S4|Clark|20|London
S4|Clark|20|London|S5|Adams|30|Athens
S5|Adams|30|Athens|S1|Smith|20|London
S5|Adams|30|Athens|S2|Jones|10|Paris
S5|Adams|30|Athens|S3|Blake|30|Paris
S5|Adams|30|Athens|S4|Clark|20|London
S5|Adams|30|Athens|S5|Adams|30|Athens