[ library(mysql) |  ]
sql_delete(+Table, +Where, ++Attributelist, ++Valuelist, -RowsDeleted)
Delete tuple(s) from database
- Table
 
- Atom or string
 
- Where
 
- Atom or string
 
- Attributelist
 
- List of atoms or strings
 
- Valuelist
 
- List of ground terms
 
- RowsDeleted
 
- Variable or integer
 
Description
    Used to delete tuples from the relation Table. The set of tuples to
    be deleted can be restricted using both Where and Attributelist/Valuelist.
    The string Where will be inserted literally after the keyword WHERE
    in the SQL DELETE instruction. If Attributelist and Valuelist are not
    empty, then only tuples whose attributes in Attributelist match the
    corresponding values in Valuelist, will be deleted.
    Both lists must have the same length. After deletion, RowsDeleted
    will be unified with the number of deleted rows. Even if the unification
    fails, the rows will remain deleted.
    
Resatisfiable
no
Examples
    % delete all 5 tuples of relation 'Adressen'
    ?- sql_delete('Adressen','',[],[],R).
    R = 5
    yes.
    % Delete from relation 'Adressen' (which has the attributes Id and Name)
    % all people with name "Schmidt" whose Id is also stored in the relation
    % 'Loeschbar'
    ?- sql_delete("Adressen","Id in (select Id from Loeschbar)",
                ["Name"],["Schmidt"],_).
    yes.
    
See Also
sql_insert / 3