create database if not exists ShoppingWebsite;
use ShoppingWebsite;



/*  node stuctor
    userAccount
    +   user_cart
    +   user_collect
*/
create table if not exists userAccount
(
    userId bigint not null,
    email varchar(50) not null,
    password varchar(16) not null,
    permission int not null default 0,
    primary key(email,userId)
);

create table if not exists user_cart
(
    user_Cart_Id bigint not null primary key,
    password varchar(16) not null,
    permission int not null default 0
);

create table if not exists user_collect
(
    user_collect_Id bigint not null primary key,
    password varchar(16) not null,
    permission int not null default 0
);


/*  node stuctor
    store
    +   goods
        +   selectionGroup
            +   selection
        +   comment
*/
create table if not exists store
(
    store_Id bigint not null primary key,
    postion varchar(100) not null,
    name varchar(50) not null,
    star int
);

create table if not exists goods
(
    goods_id bigint not null primary key,
    postion varchar(100) not null,
    name varchar(50) not null,
    star int
);

create table if not exists selectionGroup
(
    selection_group_id bigint not null primary key,
    name varchar(50) not null
);

create table if not exists selection
(
    selection_id bigint not null primary key,
    name varchar(50) not null,
    price float(13,2)
);


/*  node*/
create table if not exists nodeinfo
(
    id bigint not null primary key,
    prev_id bigint null,
    next_id bigint null,
    parent_id bigint null,
    child_id bigint null,
    obj_type varchar(100) default 'group04.BasicNode'
);
