Populating the Sample Tables

The following scripts can be used to populate the sample tables.

Tip

If you have downloaded the populated Microsoft Access MDB file you will not have to run these scripts.


Caution

Do not run the following scripts more than once. If you have primary keys defined (and you should) then running these scripts a second time will generate SQL errors. If you do not have primary keys defined you'll end up with duplicate data (and your query results will not match those shown in the examples).


The VENDORS Table

INSERT INTO Vendors(vend_id,
                      vend_name,
                      vend_address,
                      vend_city,
                      vend_state,
                      vend_zip)
VALUES('BRS01',
        'Bears R Us',
        '123 Main Street',
        'Bear Town',
        'MI',
        '44444'),
INSERT INTO Vendors(vend_id,
                      vend_name,
                      vend_address,
                      vend_city,
                      vend_state,
                      vend_zip)
VALUES('BRE02',
        'Bear Emporium',
        '500 Park Street',
        'Anytown',
        'OH',
        '44333'),
INSERT INTO Vendors(vend_id,
                      vend_name,
                      vend_address,
                      vend_city,
                      vend_state,
                      vend_zip)
VALUES('DLL01',
        'Doll House Inc.',
        '555 High Street',
        'Dollsville',
        'CA',
        '99999'),
INSERT INTO Vendors(vend_id,
                      vend_name,
                      vend_address,
                      vend_city,
                      vend_state,
                      vend_zip)
VALUES('FRB01',
        'Furball Inc.',
        '1000 5th Avenue',
        'New York',
        'NY',
        '11111'),

The PRODUCTS Table

INSERT INTO Products(prod_id,
                       vend_id,
                       prod_name,
                       prod_price,
                       prod_desc)
VALUES('BR01',
        'BRS01',
        '8 inch teddy bear',
        5.99,
        '8 inch teddy bear, comes with cap and jacket'),
INSERT INTO Products(prod_id,
                       vend_id,
                       prod_name,
                       prod_price,
                       prod_desc)
VALUES('BR02',
        'BRS01',
        '12 inch teddy bear',
        8.99,
        '12 inch teddy bear, comes with cap and jacket'),
INSERT INTO Products(prod_id,
                       vend_id,
                       prod_name,
                       prod_price,
                       prod_desc)
VALUES('BR03',
        'BRS01',
        '18 inch teddy bear',
        11.99,
        '18 inch teddy bear, comes with cap and jacket'),
INSERT INTO Products(prod_id,
                       vend_id,
                       prod_name,
                       prod_price,
                       prod_desc)
VALUES('BNBG01',
        'DLL01',
        'Fish bean bag toy',
        3.49,
        'Fish bean bag toy, complete with bean bag worms with which to feed it'),
        INSERT INTO Products(prod_id,
                       vend_id,
                       prod_name,
                       prod_price,
                       prod_desc)
VALUES('BNBG02',
        'DLL01',
        'Bird bean bag toy',
        3.49,
        'Bird bean bag toy, eggs are not included'),
INSERT INTO Products(prod_id,
                       vend_id,
                       prod_name,
                       prod_price,
                       prod_desc)
VALUES('BNBG03',
        'DLL01',
        'Rabbit bean bag toy',
        3.49,
        'Rabbit bean bag toy, comes with bean bag carrots'),
INSERT INTO Products(prod_id,
                       vend_id,
                       prod_name,
                       prod_price,
                       prod_desc)
VALUES('RGAN01',
        'DLL01',
        'Raggedy Ann',
        4.99,
        '18 inch Raggedy Ann doll'),

The CUSTOMERS Table

INSERT INTO Customers(cust_id,
                        cust_name,
                        cust_address,
                        cust_city,
                        cust_state,
                        cust_zip,
                        cust_contact,
                        cust_email)
VALUES('1000000001',
        'Village Toys',
        '200 Maple Lane',
        'Detroit',
        'MI',
        '44444',
        'John Smith',
        '[email protected]'),
INSERT INTO Customers(cust_id,
                        cust_name,
                        cust_address,
                        cust_city,
                        cust_state,
                        cust_zip,
                        cust_contact,
                        cust_email)
VALUES('1000000002',
        'Kids Place',
        '333 South Lake Drive',
        'Columbus',
        'OH',
        '43333',
        'Michelle Green'),
INSERT INTO Customers(cust_id,
                        cust_name,
                        cust_address,
                        cust_city,
                        cust_state,
                        cust_zip,
                        cust_contact,
                        cust_email)
VALUES('1000000003',
        'Fun4All',
        '1 Sunny Place',
        'Muncie',
        'IN',
        '42222',
        'Jim Jones',
       '[email protected]'),
INSERT INTO Customers(cust_id,
                        cust_name,
                        cust_address,
                        cust_city,
                        cust_state,
                        cust_zip,
                        cust_contact,
                        cust_email)
VALUES('1000000004',
        'Fun4All',
        '829 Riverside Drive',
        'Phoenix',
        'AZ',
        '88888',
        'Denise L. Stephens',
        '[email protected]'),
INSERT INTO Customers(cust_id,
                        cust_name,
                        cust_address,
                        cust_city,
                        cust_state,
                        cust_zip,
                        cust_contact,
                        cust_email)
VALUES('1000000005',
        'The Toy Store',
        '4545 53rd Street',
        'Chicago',
        'IL',
        '54545',
        'Kim Howard'),

The ORDERS Table

INSERT INTO Orders(order_num,
                     order_date,
                     cust_id)
VALUES(20005,
        '1999/5/1',
        '1000000001'),
INSERT INTO Orders(order_num,
                     order_date,
                     cust_id)
VALUES(20006,
        '1999/1/12',
        '1000000003'),
INSERT INTO Orders(order_num,
                     order_date,
                     cust_id)
VALUES(20007,
        '1999/1/30',
        '1000000004'),
INSERT INTO Orders(order_num,
                     order_date,
                     cust_id)
VALUES(20008,
        '1999/2/3',
        '1000000005'),
INSERT INTO Orders(order_num,
                     order_date,
                     cust_id)
VALUES(20009,
        '1999/2/8',
        '1000000001'),

The ORDERITEMS Table

INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20005,
        1,
        'BR01',
        100,
        5.49);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20005,
        2,
        'BR03',
        100,
        10.99);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20006,
        1,
        'BR01',
        20,
        5.99);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20006,
        2,
        'BR02',
        10,
        8.99);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20006,
        3,
        'BR03',
        10,
        11.99);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20007,
        1,
        'BR03',
        50,
        11.49);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20007,
        2,
        'BNBG01',
        100,
        2.99);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20007,
        3,
        'BNBG02',
        100,
        2.99);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20007,
        4,
        'BNBG03',
        100,
        2.99);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20007,
        5,
        'RGAN01',
        50,
        4.49);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20008,
        1,
        'RGAN01',
        5,
        4.99);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20008,
        2,
        'BR03',
        5,
        11.99);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20008,
        3,
        'BNBG01',
        10,
        3.49);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20008,
        4,
        'BNBG02',
        10,
        3.49);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20008,
        5,
        'BNBG03',
        10,
        3.49);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20009,
        1,
        'BNBG01',
        250,
        2.49);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20009,
        2,
        'BNBG02',
        250,
        2.49);
INSERT INTO OrderItems(order_num,
                         order_item,
                         prod_id,
                         quantity,
                         item_price)
VALUES(20009,
        3,
        'BNBG03',
        250,
        2.49);

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.110.116