
SET SQL DIALECT 3; 

/* CREATE DATABASE 'division.fdb' PAGE_SIZE 4096 DEFAULT CHARACTER SET NONE */



/* Table: R, Owner: SYSDBA */
CREATE TABLE R (X INTEGER NOT NULL,
        Y CHAR(1) NOT NULL,
CONSTRAINT PK_S PRIMARY KEY (X, Y));

/* Table: S, Owner: SYSDBA */
CREATE TABLE S (Y CHAR(1) NOT NULL,
CONSTRAINT PK_R PRIMARY KEY (Y));

/* View: X1, Owner: SYSDBA */
CREATE VIEW X1 (X) AS

SELECT DISTINCT X FROM R;

/* View: S_X_X1, Owner: SYSDBA */
CREATE VIEW S_X_X1 (X, Y) AS

SELECT DISTINCT X1.X,S.Y FROM S,X1;

/* View: S_X_X1_MINUS_R, Owner: SYSDBA */
CREATE VIEW S_X_X1_MINUS_R (X, Y) AS
 
SELECT DISTINCT SS.X,SS.Y  FROM S_x_X1 SS LEFT JOIN R ON SS.X = R.X AND SS.Y = R.Y WHERE R.X IS NULL AND R.Y IS NULL;

/* View: X2, Owner: SYSDBA */
CREATE VIEW X2 (X) AS
 
SELECT DISTINCT X  FROM S_X_X1_MINUS_R;

/* View: X, Owner: SYSDBA */
CREATE VIEW X (X) AS

SELECT DISTINCT X1.X FROM X1 LEFT JOIN X2 ON X1.X = X2.X
WHERE X2.X IS NULL;
