4-rings or 4-squares puzzle

You are encouraged to solve this task according to the task description, using any language you may know.
Task

Replace       a, b, c, d, e, f,   and
  g        with the decimal
digits   LOW   ───►   HIGH

such that the sum of the letters inside of each of the four large squares add up to
the same sum.

            ╔══════════════╗      ╔══════════════╗
            ║              ║      ║              ║
            ║      a       ║      ║      e       ║
            ║              ║      ║              ║
            ║          ┌───╫──────╫───┐      ┌───╫─────────┐
            ║          │   ║      ║   │      │   ║         │
            ║          │ b ║      ║ d │      │ f ║         │
            ║          │   ║      ║   │      │   ║         │
            ║          │   ║      ║   │      │   ║         │
            ╚══════════╪═══╝      ╚═══╪══════╪═══╝         │
                       │       c      │      │      g      │
                       │              │      │             │
                       │              │      │             │
                       └──────────────┘      └─────────────┘

Show all output here.



   Show all solutions for each letter being unique with
        LOW=1     HIGH=7

   Show all solutions for each letter being unique with
        LOW=3     HIGH=9

   Show only the   number   of solutions when each letter can be non-unique
        LOW=0     HIGH=9



Related task

 Solve the no connection puzzle


 
CREATE TABLE allints (v NUMBER);
CREATE TABLE results 
(
a NUMBER,
b NUMBER,
c NUMBER,
d NUMBER,
e NUMBER,
f NUMBER,
g NUMBER
);
 
CREATE OR REPLACE PROCEDURE foursquares(lo NUMBER,hi NUMBER,uniq BOOLEAN,show BOOLEAN)
AS
    a NUMBER;
    b NUMBER;
    c NUMBER;
    d NUMBER;
    e NUMBER;
    f NUMBER;
    g NUMBER;
    out_line VARCHAR2(2000);
 
    CURSOR results_cur IS 
    SELECT
       a,
       b,
       c,
       d,
       e,
       f,
       g
    FROM
        results
    ORDER BY 
        a,b,c,d,e,f,g;
 
    results_rec results_cur%ROWTYPE;
 
    solutions NUMBER;
    uorn VARCHAR2(2000);
BEGIN
    solutions := 0;
    DELETE FROM allints;
    DELETE FROM results;
    FOR i IN lo..hi LOOP
        INSERT INTO allints VALUES (i);
    END LOOP;
    COMMIT;
 
    IF uniq = TRUE THEN
        INSERT INTO results
            SELECT
                a.v a,
                b.v b,
                c.v c,
                d.v d,
                e.v e,
                f.v f,
                g.v g
            FROM
                allints a, allints b, allints c,allints d,
                allints e, allints f, allints g
            WHERE
                a.v NOT IN (b.v,c.v,d.v,e.v,f.v,g.v) AND
                b.v NOT IN (c.v,d.v,e.v,f.v,g.v) AND
                c.v NOT IN (d.v,e.v,f.v,g.v) AND
                d.v NOT IN (e.v,f.v,g.v) AND
                e.v NOT IN (f.v,g.v) AND
                f.v NOT IN (g.v) AND
                a.v = c.v + d.v AND
                g.v = d.v + e.v AND
                b.v = e.v + f.v - c.v
            ORDER BY 
                a,b,c,d,e,f,g;
        uorn := ' unique solutions in ';
    ELSE
        INSERT INTO results
            SELECT
                a.v a,
                b.v b,
                c.v c,
                d.v d,
                e.v e,
                f.v f,
                g.v g
            FROM
                allints a, allints b, allints c,allints d,
                allints e, allints f, allints g
            WHERE
                a.v = c.v + d.v AND
                g.v = d.v + e.v AND
                b.v = e.v + f.v - c.v
            ORDER BY 
                a,b,c,d,e,f,g;   
        uorn := ' non-unique solutions in ';
    END IF;
    COMMIT;
 
    OPEN results_cur;
    LOOP
        FETCH results_cur INTO results_rec;
        EXIT WHEN results_cur%notfound;
        a := results_rec.a;
        b := results_rec.b;
        c := results_rec.c;
        d := results_rec.d;
        e := results_rec.e;
        f := results_rec.f;
        g := results_rec.g;
 
        solutions := solutions + 1;
        IF show = TRUE THEN
            out_line := TO_CHAR(a) || ' ';
            out_line := out_line || ' ' || TO_CHAR(b) || ' ';
            out_line := out_line || ' ' || TO_CHAR(c) || ' ';
            out_line := out_line || ' ' || TO_CHAR(d) || ' ';
            out_line := out_line || ' ' || TO_CHAR(e) || ' ';
            out_line := out_line || ' ' || TO_CHAR(f) ||' ';
            out_line := out_line || ' ' || TO_CHAR(g);
        END IF;
 
        DBMS_OUTPUT.put_line(out_line);
    END LOOP;
    CLOSE results_cur;
    out_line := TO_CHAR(solutions) || uorn;
    out_line := out_line || TO_CHAR(lo) || ' to ' || TO_CHAR(hi);
    DBMS_OUTPUT.put_line(out_line);
 
END;
/
 