Login   Register  
PHP Classes
elePHPant
Icontem

File: csa_test_data.sql

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Roberto Andrade Fonseca  >  Cascade Select Associative  >  csa_test_data.sql  >  Download  
File: csa_test_data.sql
Role: Auxiliary data
Content type: text/plain
Description: SQL script to create and populate a test database for cascadeSelectAssoc
Class: Cascade Select Associative
Generate two dependent HTML form select inputs
Author: By
Last change:
Date: 9 years ago
Size: 1,833 bytes
 

Contents

Class file image Download
---------------------------------------------------------------------------
-- SQL script to create and populate a test database for cascadeSelectAssoc
-- This script has been tested with PostgreSQL 7.4.x
---------------------------------------------------------------------------

\c template1
DROP DATABASE csa_test_db;
CREATE DATABASE csa_test_db;
\c csa_test_db

CREATE TABLE mothers (
	id_mother		SERIAL,
	mother		VARCHAR(25),
	PRIMARY KEY (id_mother)
);

CREATE TABLE children (
	id_child	SERIAL,
	id_mother	INTEGER,
	child		VARCHAR(50),
	PRIMARY KEY (id_child, id_mother), 
	FOREIGN KEY (id_mother)
   		REFERENCES mothers
);

INSERT INTO mothers (mother) VALUES ('Operating Systems');
INSERT INTO mothers (mother) VALUES ('Programming Languages');
INSERT INTO mothers (mother) VALUES ('Databases');
INSERT INTO mothers (mother) VALUES ('Web Browsers');

INSERT INTO children (id_mother, child) VALUES (1,'Linux');
INSERT INTO children (id_mother, child) VALUES (1,'OS X');
INSERT INTO children (id_mother, child) VALUES (1,'OpenBSD');
INSERT INTO children (id_mother, child) VALUES (1,'Solaris');
INSERT INTO children (id_mother, child) VALUES (2,'Perl');
INSERT INTO children (id_mother, child) VALUES (2,'PHP');
INSERT INTO children (id_mother, child) VALUES (2,'Python');
INSERT INTO children (id_mother, child) VALUES (2,'Ruby');
INSERT INTO children (id_mother, child) VALUES (3,'PostgreSQL');
INSERT INTO children (id_mother, child) VALUES (3,'MySQL');
INSERT INTO children (id_mother, child) VALUES (3,'Firebird');
INSERT INTO children (id_mother, child) VALUES (3,'MaxDB');
INSERT INTO children (id_mother, child) VALUES (4,'Firefox');
INSERT INTO children (id_mother, child) VALUES (4,'Opera');
INSERT INTO children (id_mother, child) VALUES (4,'Lynx');
INSERT INTO children (id_mother, child) VALUES (4,'Mozilla');