57 lines
1.2 KiB
MySQL
57 lines
1.2 KiB
MySQL
|
-- sample data to test SQLite
|
||
|
|
||
|
-- TABLE TEST
|
||
|
DROP TABLE IF EXISTS TEST1;
|
||
|
CREATE TABLE TEST1 (
|
||
|
TEST_NAME TEXT NOT NULL,
|
||
|
TEST_ID INTEGER DEFAULT '0' NOT NULL,
|
||
|
TEST_DATE TEXT NOT NULL,
|
||
|
CONSTRAINT PK_TEST PRIMARY KEY (TEST_ID)
|
||
|
);
|
||
|
|
||
|
-- TABLE TEST2 with some CONSTRAINTs and an INDEX
|
||
|
DROP TABLE IF EXISTS TEST2;
|
||
|
CREATE TABLE TEST2 (
|
||
|
ID INTEGER NOT NULL,
|
||
|
FIELD1 INTEGER,
|
||
|
FIELD2 TEXT,
|
||
|
FIELD3 TEXT,
|
||
|
FIELD4 INTEGER,
|
||
|
FIELD5 INTEGER,
|
||
|
ID2 INTEGER NOT NULL,
|
||
|
CONSTRAINT PK_TEST2 PRIMARY KEY (ID2),
|
||
|
CONSTRAINT TEST2_FIELD1ID_IDX UNIQUE (ID, FIELD1),
|
||
|
CONSTRAINT TEST2_FIELD4_IDX UNIQUE (FIELD4)
|
||
|
);
|
||
|
CREATE INDEX TEST2_FIELD5_IDX ON TEST2 (FIELD5);
|
||
|
|
||
|
-- TABLE NUMBERS
|
||
|
DROP TABLE IF EXISTS NUMBERS;
|
||
|
CREATE TABLE NUMBERS (
|
||
|
NUMBER INTEGER DEFAULT 0 NOT NULL,
|
||
|
EN TEXT NOT NULL,
|
||
|
FR TEXT NOT NULL
|
||
|
);
|
||
|
|
||
|
-- TABLE NEWTABLE
|
||
|
DROP TABLE IF EXISTS NEWTABLE;
|
||
|
CREATE TABLE NEWTABLE (
|
||
|
ID INTEGER DEFAULT 0 NOT NULL,
|
||
|
SOMENAME TEXT,
|
||
|
SOMEDATE TEXT NOT NULL,
|
||
|
CONSTRAINT PKINDEX_IDX PRIMARY KEY (ID)
|
||
|
);
|
||
|
|
||
|
-- VIEW on TEST
|
||
|
DROP VIEW IF EXISTS "testview";
|
||
|
CREATE VIEW "testview" AS
|
||
|
SELECT *
|
||
|
FROM TEST1
|
||
|
WHERE TEST_NAME LIKE 't%';
|
||
|
|
||
|
-- VIEW on NUMBERS
|
||
|
DROP VIEW IF EXISTS "numbersview";
|
||
|
CREATE VIEW "numbersview" AS
|
||
|
SELECT *
|
||
|
FROM NUMBERS
|
||
|
WHERE NUMBER > 100;
|