-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements.  See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License.  You may obtain a copy of the License at
--
--     http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.



CREATE TABLE IF NOT EXISTS Users

(userid VARCHAR(15) PRIMARY KEY CHECK (NOT NULL),

name VARCHAR(50),

password VARCHAR(24),

address VARCHAR(96),

cash FLOAT) ;





CREATE TABLE IF NOT EXISTS userstocks

(id VARCHAR(15),

 userid VARCHAR(15),

 name VARCHAR(100),

 price FLOAT,

 quantity INT);

 

ALTER TABLE userstocks ADD CONSTRAINT prim PRIMARY KEY(id,userid);

 



CREATE TABLE IF NOT EXISTS stocks

(id VARCHAR(8) PRIMARY KEY CHECK (NOT NULL),

 name VARCHAR(100),

 price FLOAT);

    

DELETE FROM Users;

#DELETE FROM TradingAccount;

DELETE FROM userstocks;

DELETE FROM stocks;



INSERT INTO Users VALUES('srini', '6 Inch',

 'cheemu','Madivala Bangalore',10000);

 

INSERT INTO Users VALUES('j2ee', 'Lee Whittaker',

 'password','Tampa Florida',100000);

 

INSERT INTO userstocks VALUES('00000001', 'j2ee','BTDA',1,10); 

 





INSERT INTO stocks VALUES('00000001',"BTDA",1.00);

INSERT INTO stocks VALUES('00000002',"Hitech Software",2.00);

INSERT INTO stocks VALUES('00000003',"Bill's Cold Storage",3.00);

INSERT INTO stocks VALUES('00000004',"Colonel's Fried Chicken",300.00);

INSERT INTO stocks VALUES('00000005',"Toyo Motors",30.00);

INSERT INTO stocks VALUES('00000006',"Timbuctoo Airlines",53.00);

INSERT INTO stocks VALUES('00000007',"Happy Undertakers",73.00);

INSERT INTO stocks VALUES('00000008',"Wacko Brothers",54.00);

INSERT INTO stocks VALUES('00000009',"Mental Studios",456.00);

INSERT INTO stocks VALUES('00000013',"ASFG",54.89);

INSERT INTO stocks VALUES('00000023',"BFG",564.50);

INSERT INTO stocks VALUES('00000033',"Mack",3444.50);

INSERT INTO stocks VALUES('00000043',"Ronan & Sons",7.50);

INSERT INTO stocks VALUES('00000053',"Bulls & Bears",553.40);

INSERT INTO stocks VALUES('00000343',"HGHU",456.00);

INSERT INTO stocks VALUES('00000603',"TTTM",77.00);

INSERT INTO stocks VALUES('00000463',"GRASF",88.00);

commit;









