ADD CONSTRAINT `diario_2011_1_ibfk_1` FOREIGN KEY (`ALUN_DIA`) REFERENCES `aluno` (`MATR_ALU`) ON UPDATE CASCADE,

Similar documents
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 to server version: nt

CS 327E Lecture 5. Shirley Cohen. February 8, 2016

CS 327E Lecture 3. Shirley Cohen. February 1, 2016

CS 327E Lecture 2. Shirley Cohen. January 27, 2016

More MySQL ELEVEN Walkthrough examples Walkthrough 1: Bulk loading SESSION

SQL Data Definition and Data Manipulation Languages (DDL and DML)

SQL (Structured Query Language)

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

Data Modeling with the Entity Relationship Model. CS157A Chris Pollett Sept. 7, 2005.

Selections. Lecture 4 Sections Robb T. Koether. Hampden-Sydney College. Wed, Jan 22, 2014

DB Creation with SQL DDL

Translation of ER-diagram into Relational Schema. Dr. Sunnie S. Chung CIS430/530

Relational Algebra Part I. CS 377: Database Systems

The Relational Model

CS 327E Lecture 5. Shirley Cohen. September 14, 2016

MTAT Introduction to Databases

IT360: Applied Database Systems. SQL: Structured Query Language DDL and DML (w/o SELECT) (Chapter 7 in Kroenke) SQL: Data Definition Language

Constraints. Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers. John Edgar 2

SQL: A COMMERCIAL DATABASE LANGUAGE. Data Change Statements,

1D D0-541 CIW v5 Database Design Specialist Version 1.7

SQL CSCI 201 Principles of Software Development

CSCI 403 Database Management. Types of Constraints. Implicit Constraints. Application-Based Constraints. Explicit Constraints 9/9/2018

School of Computing and Information Technology. Examination Paper Autumn 2016

SQL Server 2008 Tutorial 3: Database Creation

Database System Concepts

6.5 Integrity Contraints: SQL Statements:

Item: 1 (Ref:Cert-1Z )

Views. Lecture 15. Robb T. Koether. Fri, Feb 16, Hampden-Sydney College. Robb T. Koether (Hampden-Sydney College) Views Fri, Feb 16, / 28

IBM DB2 UDB V7.1 Family Fundamentals.

ACS-3902 Fall Ron McFadyen 3D21 Slides are based on chapter 5 (7 th edition) (chapter 3 in 6 th edition)

Assignment 3 Translation from ER to Relational & Table Creation By Alexander Joel Heriford

Relational Databases. Week 7 INFM 603

Fname A variable character field up to 15 characters in length. Must have a value Lname A variable character field up to 15

GlobAl EDITION. Database Concepts SEVENTH EDITION. David M. Kroenke David J. Auer

Lecture5 Functional Dependencies and Normalization for Relational Databases

Creating a Relational Database Using Microsoft SQL Code. Farrokh Alemi, Ph.D.

DATABASE DESIGN - 1DL400

SQL Data Definition Language

Comp 5311 Database Management Systems. 4b. Structured Query Language 3

Relational Databases

MTAT Introduction to Databases

08/07/ STATE PRIMARY EATON COUNTY

doc. RNDr. Tomáš Skopal, Ph.D. RNDr. Michal Kopecký, Ph.D.

Introduction to SQL Server 2005/2008 and Transact SQL

Introduction to Databases CSE 414. Lecture 2: Data Models

CSCI Design of Database Systems, Fall 2016

Referential Integrity and Other Table Constraints Ray Lockwood

Handout 4. Logical Database Modeling, Part 1: Relational Data Model. Transforming EER model to Relational.

Views. Lecture 15 Section 5.3. Robb T. Koether. Hampden-Sydney College. Mon, Feb 18, 2013

Transforming ER to Relational Schema

Views. Lecture 15 Section 5.3. Robb T. Koether. Hampden-Sydney College. Mon, Feb 18, 2013

Announcements. Using Electronics in Class. Review. Staff Instructor: Alvin Cheung Office hour on Wednesdays, 1-2pm. Class Overview

CSE 344 JANUARY 8 TH SQLITE AND JOINS

Guides for Installing MS SQL Server and Creating Your First Database. Please see more guidelines on installing procedure on the class webpage

Introduction to Databases and SQL

CS2300: File Structures and Introduction to Database Systems

Chapter 4. Basic SQL. SQL Data Definition and Data Types. Basic SQL. SQL language SQL. Terminology: CREATE statement

DATABASE DESIGN - 1DL400

CMPT 354: Database System I. Lecture 2. Relational Model

Introduction to Databases. MySQL Syntax Guide: Day 1

Domain Constraints Referential Integrity Assertions Triggers. Authorization Authorization in SQL

Introduction to Data Management. Lecture #6 E-Rà Relational Mapping (Cont.)

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering Fall 2011 ECOM 4113: Database System Lab Eng.

Session Active Databases (2+3 of 3)

COSC Assignment 2

School of Computing and Information Technology Session: Spring CSCI835 Database Systems (Bridging Subject) Sample class test 23 July 2018

Integrity and Security

ACCESS isn t only a great development tool it s

Department of Computer Science University of Cyprus. EPL342 Databases. Lab 2

Normalization in Databases

Database System Concepts"

Chapter 17: Table & Integrity Contraints. Informatics Practices Class XII. By- Rajesh Kumar Mishra. KV No.1, AFS, Suratgarh

2.9 Table Creation. CREATE TABLE TableName ( AttrName AttrType, AttrName AttrType,... )

Structured Query Language (SQL)

Introduction to Data Management. Lecture #5 (E-R Relational, Cont.)

1D0-541_formatted. Number: Passing Score: 800 Time Limit: 120 min File Version: 1.

For the Dorm Energy Monitoring DB design, some constraints are given and some are absent. You are asked to fill in some of these absent constraints.

SQL: Data Definition Language

SQL: Concepts. Todd Bacastow IST 210: Organization of Data 2/17/ IST 210

Slides by: Ms. Shree Jaswal

Lecture7: SQL Overview, Oracle Data Type, DDL and Constraints Part #2

Babu Madhav Institute of Information Technology 2015

Lecture 3 SQL. Shuigeng Zhou. September 23, 2008 School of Computer Science Fudan University

Full file at

Draft. Students Table. FName LName StudentID College Year. Justin Ennen Science Senior. Dan Bass Management Junior

Lab # 2 Hands-On. DDL Basic SQL Statements Institute of Computer Science, University of Tartu, Estonia

MySQL. A practical introduction to database design

Data Modeling Using the Entity-Relationship Model

King Fahd University of Petroleum and Minerals

Data Base Lab. The Microsoft SQL Server Management Studio Part-3- By :Eng.Alaa I.Haniy.

Database Technology. Topic 3: SQL. Olaf Hartig.

D B M G. SQL language: basics. Managing tables. Creating a table Modifying table structure Deleting a table The data dictionary Data integrity

1.264 Lecture 6. Data modeling

Introduction to SQL on GRAHAM ED ARMSTRONG SHARCNET AUGUST 2018

Comp 519: Web Programming Autumn 2015

Chapter 8 SQL-99: Schema Definition, Basic Constraints, and Queries

Information Systems Engineering. SQL Structured Query Language DDL Data Definition (sub)language

EE221 Databases Practicals Manual

PhoneBook (Sorting) You will be modifying your PhoneBook class to sort by different fields in a contact.

Database Systems ER Model. A.R. Hurson 323 CS Building

Transcription:

ÍNDICES E RESTRIÇÕES select * from aluno group by data_alu; show index from aluno; alter table aluno add index xx (data_alu ALTER TABLE aluno drop index xx; explain select * from finan_cliente where nome_cli in ('André Luis Soares Smarra','Thadeu Alves Vieira' alter table disciplina add index hhh (hora_dis, sigla_dis) RESTRIÇÕES -- -- Restrições para a tabela `diario_2011_1` -- ALTER TABLE `diario_2011_1` ADD CONSTRAINT `diario_2011_1_ibfk_1` FOREIGN KEY (`ALUN_DIA`) REFERENCES `aluno` (`MATR_ALU`) ON UPDATE CASCADE, ADD CONSTRAINT `diario_2011_1_ibfk_2` FOREIGN KEY (`TURM_DIA`, `DISC_DIA`, `PROF_DIA`) REFERENCES `diario_cabecalho_2011_1` (`TURM_DCA`, `DISC_DCA`, `PROF_DCA`) ON DELETE CASCADE; /* begin table creation */ create table department (dept_id smallint unsigned not null auto_increment,

name varchar(20) not null, constraint pk_department primary key (dept_id) create table branch (branch_id smallint unsigned not null auto_increment, name varchar(20) not null, address varchar(30), city varchar(20), state varchar(2), zip varchar(12), constraint pk_branch primary key (branch_id) create table employee (emp_id smallint unsigned not null auto_increment, fname varchar(20) not null, lname varchar(20) not null, start_date date not null, end_date date, superior_emp_id smallint unsigned, dept_id smallint unsigned, title varchar(20), assigned_branch_id smallint unsigned, constraint fk_e_emp_id foreign key (superior_emp_id) references employee (emp_id), constraint fk_dept_id foreign key (dept_id) references department (dept_id), constraint fk_e_branch_id foreign key (assigned_branch_id) references branch (branch_id), constraint pk_employee primary key (emp_id) create table product_type (product_type_cd varchar(10) not null, name varchar(50) not null, constraint pk_product_type primary key (product_type_cd)

create table product (product_cd varchar(10) not null, name varchar(50) not null, product_type_cd varchar(10) not null, date_offered date, date_retired date, constraint fk_product_type_cd foreign key (product_type_cd) references product_type (product_type_cd), constraint pk_product primary key (product_cd) create table customer (cust_id integer unsigned not null auto_increment, fed_id varchar(12) not null, cust_type_cd enum('i','b') not null, address varchar(30), city varchar(20), state varchar(20), postal_code varchar(10), constraint pk_customer primary key (cust_id) create table individual (cust_id integer unsigned not null, fname varchar(30) not null, lname varchar(30) not null, birth_date date, constraint fk_i_cust_id foreign key (cust_id) references customer (cust_id), constraint pk_individual primary key (cust_id) create table business (cust_id integer unsigned not null, name varchar(40) not null,

state_id varchar(10) not null, incorp_date date, constraint fk_b_cust_id foreign key (cust_id) references customer (cust_id), constraint pk_business primary key (cust_id) create table officer (officer_id smallint unsigned not null auto_increment, cust_id integer unsigned not null, fname varchar(30) not null, lname varchar(30) not null, title varchar(20), start_date date not null, end_date date, constraint fk_o_cust_id foreign key (cust_id) references business (cust_id), constraint pk_officer primary key (officer_id) create table account (account_id integer unsigned not null auto_increment, product_cd varchar(10) not null, cust_id integer unsigned not null, open_date date not null, close_date date, last_activity_date date, status enum('active','closed','frozen'), open_branch_id smallint unsigned, open_emp_id smallint unsigned, avail_balance float(10,2), pending_balance float(10,2), constraint fk_product_cd foreign key (product_cd) references product (product_cd), constraint fk_a_cust_id foreign key (cust_id) references customer (cust_id), constraint fk_a_branch_id foreign key (open_branch_id)

references branch (branch_id), constraint fk_a_emp_id foreign key (open_emp_id) references employee (emp_id), constraint pk_account primary key (account_id) create table transaction (txn_id integer unsigned not null auto_increment, txn_date datetime not null, account_id integer unsigned not null, txn_type_cd enum('dbt','cdt'), amount double(10,2) not null, teller_emp_id smallint unsigned, execution_branch_id smallint unsigned, funds_avail_date datetime, constraint fk_t_account_id foreign key (account_id) references account (account_id), constraint fk_teller_emp_id foreign key (teller_emp_id) references employee (emp_id), constraint fk_exec_branch_id foreign key (execution_branch_id) references branch (branch_id), constraint pk_transaction primary key (txn_id) /* end table creation */ /* begin data population */ /* department data */ insert into department (dept_id, name) values (null, 'Operations'), (null, 'Loans'), (null, 'Administration' /* branch data */

insert into branch (branch_id, name, address, city, state, zip) values (null, 'Headquarters', '3882 Main St.', 'Waltham', 'MA', '02451'), (null, 'Woburn Branch', '422 Maple St.', 'Woburn', 'MA', '01801'), (null, 'Quincy Branch', '125 Presidential Way', 'Quincy', 'MA', '02169'), (null, 'So. NH Branch', '378 Maynard Ln.', 'Salem', 'NH', '03079' /* employee data */ insert into employee (emp_id, fname, lname, start_date, dept_id, title, assigned_branch_id) values (null, 'Michael', 'Smith', '2005-06-22', (select dept_id from department where name = 'Administration'), 'President', (select branch_id from branch where name = 'Headquarters')), (null, 'Susan', 'Barker', '2006-09-12', (select dept_id from department where name = 'Administration'), 'Vice President', (select branch_id from branch where name = 'Headquarters')), (null, 'Robert', 'Tyler', '2005-02-09', (select dept_id from department where name = 'Administration'), 'Treasurer', (select branch_id from branch where name = 'Headquarters')), (null, 'Susan', 'Hawthorne', '2006-04-24', 'Operations Manager', (select branch_id from branch where name = 'Headquarters')), (null, 'John', 'Gooding', '2007-11-14', (select dept_id from department where name = 'Loans'), 'Loan Manager', (select branch_id from branch where name = 'Headquarters')), (null, 'Helen', 'Fleming', '2008-03-17', 'Head Teller', (select branch_id from branch where name = 'Headquarters')),

(null, 'Chris', 'Tucker', '2008-09-15', 'Teller', (select branch_id from branch where name = 'Headquarters')), (null, 'Sarah', 'Parker', '2006-12-02', 'Teller', (select branch_id from branch where name = 'Headquarters')), (null, 'Jane', 'Grossman', '2006-05-03', 'Teller', (select branch_id from branch where name = 'Headquarters')), (null, 'Paula', 'Roberts', '2006-07-27', 'Head Teller', (select branch_id from branch where name = 'Woburn Branch')), (null, 'Thomas', 'Ziegler', '2004-10-23', 'Teller', (select branch_id from branch where name = 'Woburn Branch')), (null, 'Samantha', 'Jameson', '2007-01-08', 'Teller', (select branch_id from branch where name = 'Woburn Branch')), (null, 'John', 'Blake', '2004-05-11', 'Head Teller', (select branch_id from branch where name = 'Quincy Branch')), (null, 'Cindy', 'Mason', '2006-08-09', 'Teller', (select branch_id from branch where name = 'Quincy Branch')), (null, 'Frank', 'Portman', '2007-04-01', 'Teller', (select branch_id from branch where name = 'Quincy Branch')), (null, 'Theresa', 'Markham', '2005-03-15',

'Head Teller', (select branch_id from branch where name = 'So. NH Branch')), (null, 'Beth', 'Fowler', '2006-06-29', 'Teller', (select branch_id from branch where name = 'So. NH Branch')), (null, 'Rick', 'Tulman', '2006-12-12', 'Teller', (select branch_id from branch where name = 'So. NH Branch') /* create data for self-referencing foreign key 'superior_emp_id' */ create temporary table emp_tmp as select emp_id, fname, lname from employee; update employee set superior_emp_id = (select emp_id from emp_tmp where lname = 'Smith' and fname = 'Michael') where ((lname = 'Barker' and fname = 'Susan') or (lname = 'Tyler' and fname = 'Robert') update employee set superior_emp_id = (select emp_id from emp_tmp where lname = 'Tyler' and fname = 'Robert') where lname = 'Hawthorne' and fname = 'Susan'; update employee set superior_emp_id = (select emp_id from emp_tmp where lname = 'Hawthorne' and fname = 'Susan') where ((lname = 'Gooding' and fname = 'John') or (lname = 'Fleming' and fname = 'Helen') or (lname = 'Roberts' and fname = 'Paula') or (lname = 'Blake' and fname = 'John') or (lname = 'Markham' and fname = 'Theresa') update employee set superior_emp_id = (select emp_id from emp_tmp where lname = 'Fleming' and fname = 'Helen') where ((lname = 'Tucker' and fname = 'Chris') or (lname = 'Parker' and fname = 'Sarah') or (lname = 'Grossman' and fname = 'Jane') update employee set superior_emp_id = (select emp_id from emp_tmp where lname = 'Roberts' and fname = 'Paula')

where ((lname = 'Ziegler' and fname = 'Thomas') or (lname = 'Jameson' and fname = 'Samantha') update employee set superior_emp_id = (select emp_id from emp_tmp where lname = 'Blake' and fname = 'John') where ((lname = 'Mason' and fname = 'Cindy') or (lname = 'Portman' and fname = 'Frank') update employee set superior_emp_id = (select emp_id from emp_tmp where lname = 'Markham' and fname = 'Theresa') where ((lname = 'Fowler' and fname = 'Beth') or (lname = 'Tulman' and fname = 'Rick') drop table emp_tmp; /* recreate employee self-referencing foreign key */ alter table employee add constraint fk_e_emp_id foreign key (superior_emp_id) references employee (emp_id /* product type data */ insert into product_type (product_type_cd, name) values ('ACCOUNT','Customer Accounts'), ('LOAN','Individual and Business Loans'), ('INSURANCE','Insurance Offerings' /* product data */ insert into product (product_cd, name, product_type_cd, date_offered) values ('CHK','checking account','account','2004-01-01'), ('SAV','savings account','account','2004-01-01'), ('MM','money market account','account','2004-01-01'), ('CD','certificate of deposit','account','2004-01-01'), ('MRT','home mortgage','loan','2004-01-01'), ('AUT','auto loan','loan','2004-01-01'), ('BUS','business line of credit','loan','2004-01-01'), ('SBL','small business loan','loan','2004-01-01'

/* residential customer data */ insert into customer (cust_id, fed_id, cust_type_cd, address, city, state, postal_code) values (null, '111-11-1111', 'I', '47 Mockingbird Ln', 'Lynnfield', 'MA', '01940'), (null, '222-22-2222', 'I', '372 Clearwater Blvd', 'Woburn', 'MA', '01801'), (null, '333-33-3333', 'I', '18 Jessup Rd', 'Quincy', 'MA', '02169'), (null, '444-44-4444', 'I', '12 Buchanan Ln', 'Waltham', 'MA', '02451'), (null, '555-55-5555', 'I', '2341 Main St', 'Salem', 'NH', '03079'), (null, '666-66-6666', 'I', '12 Blaylock Ln', 'Waltham', 'MA', '02451'), (null, '777-77-7777', 'I', '29 Admiral Ln', 'Wilmington', 'MA', '01887'), (null, '888-88-8888', 'I', '472 Freedom Rd', 'Salem', 'NH', '03079'), (null, '999-99-9999', 'I', '29 Maple St', 'Newton', 'MA', '02458'), (null, '04-1111111', 'B', '7 Industrial Way', 'Salem', 'NH', '03079'), (null, '04-2222222', 'B', '287A Corporate Ave', 'Wilmington', 'MA', '01887'), (null, '04-3333333', 'B', '789 Main St', 'Salem', 'NH', '03079'), (null, '04-4444444', 'B', '4772 Presidential Way', 'Quincy', 'MA', '02169' insert into individual (cust_id, fname, lname, birth_date) select cust_id, 'James', 'Hadley', '1977-04-22' where fed_id = '111-11-1111' select cust_id, 'Susan', 'Tingley', '1973-08-15' where fed_id = '222-22-2222' select cust_id, 'Frank', 'Tucker', '1963-02-06' where fed_id = '333-33-3333' select cust_id, 'John', 'Hayward', '1971-12-22' where fed_id = '444-44-4444'

select cust_id, 'Charles', 'Frasier', '1976-08-25' where fed_id = '555-55-5555' select cust_id, 'John', 'Spencer', '1967-09-14' where fed_id = '666-66-6666' select cust_id, 'Margaret', 'Young', '1951-03-19' where fed_id = '777-77-7777' select cust_id, 'George', 'Blake', '1982-07-01' where fed_id = '888-88-8888' select cust_id, 'Richard', 'Farley', '1973-06-16' where fed_id = '999-99-9999'; /* corporate customer data */ insert into business (cust_id, name, state_id, incorp_date) select cust_id, 'Chilton Engineering', '12-345-678', '1995-05-01' where fed_id = '04-1111111' select cust_id, 'Northeast Cooling Inc.', '23-456-789', '2001-01-01' where fed_id = '04-2222222' select cust_id, 'Superior Auto Body', '34-567-890', '2002-06-30' where fed_id = '04-3333333' select cust_id, 'AAA Insurance Inc.', '45-678-901', '1999-05-01'

where fed_id = '04-4444444'; insert into officer (officer_id, cust_id, fname, lname, title, start_date) select null, cust_id, 'John', 'Chilton', 'President', '1995-05-01' where fed_id = '04-1111111' select null, cust_id, 'Paul', 'Hardy', 'President', '2001-01-01' where fed_id = '04-2222222' select null, cust_id, 'Carl', 'Lutz', 'President', '2002-06-30' where fed_id = '04-3333333' select null, cust_id, 'Stanley', 'Cheswick', 'President', '1999-05-01' where fed_id = '04-4444444'; /* residential account data */ c where b.city = 'Woburn' limit 1) e (select 'CHK' prod_cd, '2000-01-15' open_date, '2005-01-04' last_date, 1057.75 avail, 1057.75 pend select 'SAV' prod_cd, '2000-01-15' open_date, '2004-12-19' last_date, 500.00 avail, 500.00 pend select 'CD' prod_cd, '2004-06-30' open_date, '2004-06-30' last_date,

3000.00 avail, 3000.00 pend) a where c.fed_id = '111-11-1111'; c where b.city = 'Woburn' limit 1) e (select 'CHK' prod_cd, '2001-03-12' open_date, '2004-12-27' last_date, 2258.02 avail, 2258.02 pend select 'SAV' prod_cd, '2001-03-12' open_date, '2004-12-11' last_date, 200.00 avail, 200.00 pend) a where c.fed_id = '222-22-2222'; c where b.city = 'Quincy' limit 1) e (select 'CHK' prod_cd, '2002-11-23' open_date, '2004-11-30' last_date, 1057.75 avail, 1057.75 pend select 'MM' prod_cd, '2002-12-15' open_date, '2004-12-05' last_date, 2212.50 avail, 2212.50 pend) a where c.fed_id = '333-33-3333';

c where b.city = 'Waltham' limit 1) e (select 'CHK' prod_cd, '2003-09-12' open_date, '2005-01-03' last_date, 534.12 avail, 534.12 pend select 'SAV' prod_cd, '2000-01-15' open_date, '2004-10-24' last_date, 767.77 avail, 767.77 pend select 'MM' prod_cd, '2004-09-30' open_date, '2004-11-11' last_date, 5487.09 avail, 5487.09 pend) a where c.fed_id = '444-44-4444'; c where b.city = 'Salem' limit 1) e (select 'CHK' prod_cd, '2004-01-27' open_date, '2005-01-05' last_date, 2237.97 avail, 2897.97 pend) a where c.fed_id = '555-55-5555'; c where b.city = 'Waltham' limit 1) e (select 'CHK' prod_cd, '2002-08-24' open_date, '2004-11-29' last_date, 122.37 avail, 122.37 pend

select 'CD' prod_cd, '2004-12-28' open_date, '2004-12-28' last_date, 10000.00 avail, 10000.00 pend) a where c.fed_id = '666-66-6666'; c where b.city = 'Woburn' limit 1) e (select 'CD' prod_cd, '2004-01-12' open_date, '2004-01-12' last_date, 5000.00 avail, 5000.00 pend) a where c.fed_id = '777-77-7777'; c where b.city = 'Salem' limit 1) e (select 'CHK' prod_cd, '2001-05-23' open_date, '2005-01-03' last_date, 3487.19 avail, 3487.19 pend select 'SAV' prod_cd, '2001-05-23' open_date, '2004-10-12' last_date, 387.99 avail, 387.99 pend) a where c.fed_id = '888-88-8888'; c

where b.city = 'Waltham' limit 1) e (select 'CHK' prod_cd, '2003-07-30' open_date, '2004-12-15' last_date, 125.67 avail, 125.67 pend select 'MM' prod_cd, '2004-10-28' open_date, '2004-10-28' last_date, 9345.55 avail, 9845.55 pend select 'CD' prod_cd, '2004-06-30' open_date, '2004-06-30' last_date, 1500.00 avail, 1500.00 pend) a where c.fed_id = '999-99-9999'; /* corporate account data */ c where b.city = 'Salem' limit 1) e (select 'CHK' prod_cd, '2002-09-30' open_date, '2004-12-15' last_date, 23575.12 avail, 23575.12 pend select 'BUS' prod_cd, '2002-10-01' open_date, '2004-08-28' last_date, 0 avail, 0 pend) a where c.fed_id = '04-1111111'; c where b.city = 'Woburn' limit 1) e

(select 'BUS' prod_cd, '2004-03-22' open_date, '2004-11-14' last_date, 9345.55 avail, 9345.55 pend) a where c.fed_id = '04-2222222'; c where b.city = 'Salem' limit 1) e (select 'CHK' prod_cd, '2003-07-30' open_date, '2004-12-15' last_date, 38552.05 avail, 38552.05 pend) a where c.fed_id = '04-3333333'; c where b.city = 'Quincy' limit 1) e (select 'SBL' prod_cd, '2004-02-22' open_date, '2004-12-17' last_date, 50000.00 avail, 50000.00 pend) a where c.fed_id = '04-4444444'; /* put $100 in all checking/savings accounts on Jan 5th, 2008 */ insert into transaction (txn_id, txn_date, account_id, txn_type_cd, amount, funds_avail_date) select null, '2008-01-05', a.account_id, 'DBT', 100, '2008-01-05' from account a where a.product_cd IN ('CHK','SAV','CD','MM'

/* end data population */