Advertisement
Guest User

sqlinformix

a guest
Jun 18th, 2019
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.26 KB | None | 0 0
  1. select * from rol
  2. select * from abempleado
  3. select * from view_personal where apellido_paterno like 'PA%'
  4.  
  5. select * from dt_gen_tabcod where tipo = 'PATH' and empresa='7'
  6. and codigo in ('FTPHOST','FTPUSER','FTPPASS')
  7.  
  8. SELECT trim(codigo) FROM gen_tabcod WHERE empresa = "7" AND tipo = "GEN_MON" AND
  9. valor1 = 2 ORDER BY 1 desc
  10.  
  11. select count(*) from pr_factura
  12. select * from cap_curso where descripcion like '%C++%'
  13. select * from con_trabajador where nombre like 'ZAN%'
  14.  
  15. select* from cp_trabajador where nombre like 'ZAND%'
  16.  
  17. select * from hr_penalidad_trab where ficha = 5570
  18. select * from sgc_firma_contrato where usuario_firma = 'ZSANCHEZ'
  19. select * from subgerencia
  20. select * from trabajadores where nombre like '%ando%'
  21. SELECT cod_unidad, descripcion, porctje_terc_inafi, porctje_terc_reta, porctje_terc_sec, porctje_cost_ing, fecha_cierre
  22. from afi_unidad WHERE empresa = '7000000'
  23. select * from clientes
  24.  
  25. /*CREATE*/
  26. create table alumno_si(
  27. alumno_num serial primary key constraint numAlumno,
  28. alumno_codigo integer unique constraint codAlumno,
  29. alumno_descripion varchar(30)
  30. )
  31.  
  32. create table curso(
  33. curso_num integer primary key constraint numCurso,
  34. curso_descripcion varchar(30),
  35. curso_creditos integer,
  36. )
  37.  
  38. /*SELECT*/
  39. select * from alumno_si
  40.  
  41. /*INSERT*/
  42. insert into alumno_si values(0, 111203, 'Zandor Sanchez')
  43. insert into alumno_si values(0, 111204, 'Stevan García')
  44. delete from alumno_si where alumno_num = 1
  45. select * from curso_si
  46.  
  47. /*DROP*/
  48. drop table alumno_si
  49.  
  50. /*UPDATE*/
  51. update alumno_si set alumno_descripion = 'Stevan Gutierrez' where alumno_num = 2;
  52.  
  53. /*LOCK*/
  54. select * from alumno_si
  55.  
  56. lock table alumno_si in exclusive mode
  57. select * from alumno_si
  58. unlock table alumno_si/*NO SE PUEDE BLOQUEAR Y DESBLOQUEAR
  59. DENTRO DE UNA TRANSACCIÓN*/
  60.  
  61. insert into alumno_si values(0, 111205, 'Milagros Villanueva')
  62.  
  63. /*BEGING WORK, COMMIT WORK, ROLLBACK WORK*/
  64.  
  65.  
  66. select * from empresa
  67. select * from servidor
  68. select * from sistema
  69. select * from recurso
  70.  
  71. select * from perconvenio
  72. select * from perpra_adenda
  73.  
  74.  
  75.  
  76. select convenio, cr, desde, hasta from perconvenio
  77. where empresa = '7' and hasta <= '2019-12-02' and cr like '266%'
  78. order by hasta desc
  79.  
  80. select * from perpra_adenda where convenio in (10138, 10139)
  81.  
  82.  
  83. /*QUERY OFICIAL: DESPUÉS DE LA FECHA 01-06-2019 Cambiar el campo texto por el nuevo código*/
  84. update perpra_adenda set texto = replace(texto, '266', '904')where convenio in (
  85. select convenio from perconvenio
  86. where empresa = '7' and cr like '266%'
  87. ) and desde >= '2019-06-01' and tipo_adenda = 'CR'
  88. /*FIN DEL QUERY OFICIAL*/
  89.  
  90. select * from perpra_adenda where convenio in (
  91. select convenio from perconvenio
  92. where empresa = '7' and cr like '266%'
  93. ) and desde >= '2019-06-01' and tipo_adenda = 'CR'
  94.  
  95. select * from perpra_adenda where convenio = 10138
  96. select * from perpra_adenda where convenio = 10139
  97.  
  98.  
  99.  
  100.  
  101.  
  102. /*QUERY OFICIAL ANTES DE LA FECHA*/
  103. insert into perpra_adenda
  104. select empresa, convenio, 5, 'CR', '2019-05-31', hasta, valor, cci, replace(texto, '266', '904'), 'XSIC', today
  105. from perpra_adenda where convenio in (
  106. select convenio from perconvenio
  107. where empresa = '7' and cr like '266%'
  108. ) and desde < '2019-06-01' and hasta >= '2019-06-01' and tipo_adenda = 'CR'
  109.  
  110. update perpra_adenda set hasta = '2019-06-01' where convenio in (
  111. select convenio from perconvenio
  112. where empresa = '7' and cr like '266%'
  113. ) and desde < '2019-06-01' and hasta >= '2019-06-01' and tipo_adenda = 'CR'
  114. /*FIN DEL QUERY OFICIAL*/
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121. /*empresa, convenio, 5, 'CR', '2019-06-01', hasta, valor, cci, replace(texto, '266', '904'), 'XSIC', today */
  122. select empresa, convenio, 5, 'CR', '2019-06-01', hasta, valor, cci, replace(texto, '266', '904'), 'XSIC', today
  123. from perpra_adenda where convenio in (
  124. select convenio from perconvenio
  125. where empresa = '7' and cr like '266%'
  126. ) and desde < '2019-06-01' and tipo_adenda = 'CR'
  127.  
  128.  
  129.  
  130. select * from perpra_adenda where convenio in (
  131. select convenio from perconvenio
  132. where empresa = '7' /*and hasta <= '2019-12-02'*/ and cr like '266%'
  133. ) and tipo_adenda = 'CR'
  134.  
  135. select * from perpra_adenda where convenio in (
  136. select convenio from perconvenio
  137. where empresa = '7' /*and hasta <= '2019-12-02'*/ and cr like '266%'
  138. ) and tipo_adenda = 'CR' and desde >= '2019-06-01'
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146. create table prueba_queries(
  147. empresa char(3),
  148. convenio integer,
  149. tipo_adenda char(10),
  150. desde date,
  151. hasta date,
  152. texto varchar(25)
  153. )
  154.  
  155. select * from prueba_queries
  156. insert into prueba_queries values ('7',10138,'CR', '2019-02-13','2019-07-13', '26610')
  157. insert into prueba_queries values ('7',10139,'CR', '2019-02-13','2019-07-12', '26610')
  158. insert into prueba_queries values ('7',10140,'CR', '2019-06-01','2019-07-12', '26610')
  159. insert into prueba_queries values ('7',10141,'CR', '2019-06-01','2019-07-12', '26610')
  160.  
  161. /*CONDICIONALES EN INFORMIX*/
  162. select p.desde,
  163. case
  164. when desde < '2019-06-01' then 'P'
  165. else 'H'
  166. end
  167. from prueba_queries p
  168.  
  169.  
  170.  
  171. update prueba_queries set texto = replace(texto, '266', '904')
  172. where desde >= '2019-06-01'
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181. select convenio, cr, desde, hasta from perconvenio
  182. where empresa = '7' and hasta <= '2019-06-01'
  183.  
  184.  
  185.  
  186. select * from perpra_adenda
  187. where convenio = 10138
  188.  
  189. select * from perpra_adenda where empresa = '7'
  190. where hasta < '2016/06/01'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement