User Tools

Site Tools


sql

Table of Contents

DB Fiddle

Update string

UPDATE data SET VALUE = REPLACE(VALUE, '123', '') WHERE ID <= 4 AND Value LIKE '%123%'
SELECT CASE <variable> WHEN <value>      THEN <returnvalue>
                       WHEN <othervalue> THEN <returnthis>
                                         ELSE <returndefaultcase>
       END AS <newcolumnname>
FROM <table>
SELECT
    FirstName, LastName,
    Salary, DOB,
    CASE Gender
        WHEN 'M' THEN 'Male'
        WHEN 'F' THEN 'Female'
    END
FROM Employees

Excerpts

SELECT A.order_number, A.header_id, B.line_id, B.quantity,
       C.hold_price_id, C.released_flag
FROM Table_A a JOIN
     Table_B b
     ON a.header_id = b.header_id JOIN
     Table_C c
     ON c.header_id = b.header_id AND c.line_id = b.line_id
WHERE a.order_number = '123';

SELECT A.N_O_PTS,CONCAT('-',A.SHAPE.SDO_POINT.X) as X, CONCAT('-',A.SHAPE.SDO_POINT.Y) as Y,b.K_LBD_OBJEKT as ID FROM O_PTS a JOIN O_PTS_LBD b ON a.K_O_PTS = b.K_O_PTS WHERE A.SHAPE IS NOT NULL
SELECT C.N_O_PTS,CONCAT('-',c.SHAPE.SDO_POINT.X) as X, CONCAT('-',c.SHAPE.SDO_POINT.Y) as Y,a.K_LBD_OBJEKT as ID FROM ISV_LBD.LBD_OBJEKT a JOIN ISV_MAIN.O_PTS_LBD b ON a.K_LBD_OBJEKT = b.K_LBD_OBJEKT JOIN ISV_MAIN.O_PTS c ON b.K_O_PTS = c.K_O_PTS WHERE a.X_LBD_OBJEKT = 1 AND c.X_O_PTS = 1 AND a.KC_LBD_VYZNAM = 17 AND a.KC_LBD_OBJEKT_TYP = 10
SELECT a.K_JPO as K,a.E_JPO as EVCJ,b.N_JPO,c.ZC_JPO,CONCAT('-',a.SHAPE.SDO_POINT.x) as Y,CONCAT('-',a.SHAPE.SDO_POINT.y) as X FROM JPO a RIGHT JOIN H_JPO b ON a.K_JPO = b.K_JPO JOIN ISV_SYSTEM.C_JPO c ON b.KC_JPO = c.KC_JPO WHERE a.X_JPO = 1 AND b.XH_JPO = 1 AND a.SHAPE IS NOT NULL
sql.txt · Last modified: 2018/06/08 15:35 by Jan Forman