= ER Model = == ЕР Дијаграм == [[Image(ER_MODEL_V1.jpg)]] == Податочни побарувања == '''Ентититети''' // 1. PRODUCT_CATEGORY a. id serial, b. category_name varchar c. constraint pk_cid primary key(id) 2. PRODUCT a. id serial b. sku varchar c. name varchar d. description varchar e. unit_price decimal f. image_url varchar g. units_in_stock integer h. date_created timestamp i. last_updated timestamp j. category_id integer k. constraint pk_id primary key(id) l. constraint fk_cid foreign key(category_id) references product_category(id) 3. CUSTOMER a. id serial b. first_name varchar c. last_name varchar d. email varchar unique e. constraint pk_customer primary key(id) 4. ADDRESS a. id serial b. city varchar c. country varchar d. street varchar e. zip_code varchar f. constraint pk_address primary_key(id) 5. ORDERS a. id bigserial b. order_tracking_number varchar c. total_price decimal d. total_quantity int e. customer_id int f. last_updated timestamp g. billing_address_id int unique h. shipping_address unique i. constraint pk_orders primary key(id) j. constraint fk_billing_add foreign key(billing_address_id) references address(id) k. constraint fk_shipping_add foreign key(shipping_address_id) references address(id) 6. ORDERED_ITEM a. id serial b. quantity int c. order_id bigserial d. product_id int e. constraint pk_order_item primary key(id) f. constraint fk_order_id foreign key(order_id) references orders(id) g. constraint fk_product_id foreign key(product_id) references product(id) // Следните два ентитети се ентитети за Држава и Град кои служат за популирање на полиња во апликацијата на front-end. 7. COUNTRY a. id serial b. code varchar c. name varchar d. constraint pk_country primary_key(id) 8. CITY a. id serial b. name varchar c. country_id int d. constraint pk_city primary key(id), e. constraint fk_country foreign key(country_id) references country(id)