tags:

views:

43

answers:

1

I am working on a webapplication

How can i create SQL for the following

Database Information

User information
Username - String
Password - String
Admin or Client - boolean
Last login – Date/Time

LogItem
typeLogItem – String (Page name?)
hitCount – int

View
PageURL
UserID

Transaction
User – String
DateTimeStamp
SKU – int
Purchase-boolean
TransactionID-int

Inventory information

Sku number - int
Item description - String
Price to customer - double
Count - in
+1  A: 
CREATE TABLE `user` (
    `id` INT auto_increment PRIMARY KEY,
    `name` VARCHAR(255),
    `password` VARCHAR(255),
    `admin` BIT,
    `last_login` DATETIME
);
CREATE TABLE `log_item` (
    `id` INT auto_increment PRIMARY KEY,
    `type` VARCHAR(255),
    `hitcount` INT   
);
CREATE TABLE `view` (
    `id` INT auto_increment PRIMARY KEY,
    `page_url` VARCHAR(255),
    `user_id` INT
);
CREATE TABLE `transaction` (
    `id` INT auto_increment PRIMARY KEY,
    `user_id` INT,
    `date` DATETIME,
    `sku` INT,
    `purchase` BIT
);
CREATE TABLE `inventory` (
    `id` INT auto_increment PRIMARY KEY,
    `sku` INT,
    `description` TEXT,
    `price` FLOAT,
    `count` INT
);

should be pretty much what you want? you might need to tweak some of the varchar sizes if they're not big enough.

oedo