Fashion Conn

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 7

CONNECT SYS/SYS@ORCLPDB AS SYSDBA

DROP USER FASHION CASCADE;


CREATE USER FASHION IDENTIFIED BY F;
GRANT DBA TO FASHION;
CONN FASHION/F@ORCLPDB

SHOW USER
SELECT TABLE_NAME FROM TABS;

------------------------------------[1]
DROP TABLE USER;

CREATE TABLE USER


(
ID NUMBER(10), --- PK
FIRST_NAME VARCHAR2(100),
LAST_NAME VARCHAR2(100),
USERNAME VARCHAR2(100),
PASSWORD VARCHAR2(100),
EMPLOYEE_ID NUMBER(10),
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE DEFAULT SYSDATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE DEFAULT SYSDATE,
);
------------------------------------[2]
------DROP TABLE DEPARTMENTS CASCADE CONSTRAINT;

CREATE TABLE DEPARTMENTS


(
DEPARTMENT_ID NUMBER(4) CONSTRAINT DEPARTMENTS_DEPARTMENT_ID_PK PRIMARY
KEY,--- PK,
DEPARTMENT_NAME VARCHAR2(30),
MANAGER_ID NUMBER(10),
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);

DESC DEPARTMENTS;

DELETE FROM DEPARTMENTS;


COMMIT;

------------------------------------[3]

CREATE TABLE EMPLOYEES


(
EMPLOYEE_ID NUMBER(10) CONSTRAINT EMPLOYEES_EMPLOYEE_ID_PK PRIMARY
KEY,--- PK
DEPARTMENT_ID NUMBER(4), --- Fk
FULL_NAME VARCHAR2(50),
EMAIL VARCHAR2(50),
PHONE_NO NUMBER(10),
NID_NO VARCHAR2(100),
PERMANENT_ADDRESS VARCHAR2(200),
PRESENT_ADDRESS VARCHAR2(200),
BASIC_SALARY NUMBER(11,2),
GROSS_SALARY NUMBER(11,2),
JOINING_DATE DATE,
RESIGN_DATE DATE,
IMAGE BLOB,
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);

DESC EMPLOYEES;
---------------

ALTER TABLE EMPLOYEES


ADD CONSTRAINT EMPLOYEES_DEPARTMENT_ID_FK FOREIGN KEY(DEPARTMENT_ID) REFERENCES
DEPARTMENTS(DEPARTMENT_ID);
----------------------

------------------------------------[4]
SUPPLIER

SUPPLIER_ID (PK) NUMBER(10) CONSTRAINT SUPPLIER_SUPPLIER_ID_PK PRIMARY KEY,---PK


SUPPLIER_NAME VARCHAR2(30),
COMPANY_NAME VARCHAR2(30),
ADDRESS VARCHAR2(100),
PHONE VARCHAR2(100),
EMAIL VARCHAR2(100),
PREVIOUS_DUE NUMBER(11,2),
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);

-------------------------------------[5]
CREATE TABLE PURCHASE_MASTER
(
BILL_NO NUMBER(30) CONSTRAINT PURCHASE_MASTER_BILL_NO_PK PRIMARY KEY,
---- PK AUTO GEN NUMBER.
SUPPLIER_ID NUMBER(10), ---- FK
PURCHAS_DATE DATE,
DISCOUNT_PCT NUMBER(11,2),
DISCOUNT_AMOUNT NUMBER(11,2),
TOTAL_AMOUNT NUMBER(11,2),
VAT_PCT NUMBER(11,2),
VAT_AMOUNT NUMBER(11,2),
TRANSPORTATION NUMBER(11,2),
NET_AMOUNT NUMBER(11,2),
PAID NUMBER(11,2),
DUE NUMBER(11,2),
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);
-------------------
ALTER TABLE PURCHASE_MASTER
ADD CONSTRAINT PURCHASE_MASTER_SUPPLIER_ID_FK FOREIGN KEY REFERENCES
SUPPLIER(SUPPLIER_ID);

------------------------------------[6]
CREATE TABLE PURCHASE_DETAILS
(
ID NUMBER(10) CONSTRAINT PURCHASE_DETAILS_ID_PK PRIMARY KEY, ----
PK
BILL_NO NUMBER(30), ----FK.
PRODUCT_ID NUMBER(10), ----FK
QTY NUMBER(10),
BUYING_PRICE NUMBER(11,2),
QTY NUMBER(10),
AMOUNT NUMBER(11,2),
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);
----------------------------
ALTER TABLE PURCHASE_DETAILS
ADD CONSTRAINT PURCHASE_DETAILS_BILL_NO_FK FOREIGN KEY REFERENCES
PURCHASE_MASTER(BILL_NO);

ALTER TABLE PURCHASE_DETAILS


ADD CONSTRAINT PURCHASE_DETAILS_PRODUCT_ID_FK FOREIGN KEY REFERENCES
PRODUCTS(PRODUCT_ID);

------------------------------------[7]

CREATE TABLE PURCHASE_DUE


(
ID NUMBER(10) CONSTRAINT PURCHASE_DUE_ID_PK PRIMARY KEY, ---- AUTO
GEN PK.
BILL_NO NUMBER(30), ----FK.
SUPPLIER_ID NUMBER(10), ---- FK
SUPPLIER_DUE NUMBER(11,2) DEFAULT 0,
PAYMENT_DATE DATE,
PAID NUMBER(11,2) DEFAULT 0,
DUE NUMBER(11,2) DEFAULT 0,
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);
-------------------
ALTER TABLE PURCHASE_DUE
ADD CONSTRAINT PURCHASE_DUE_BILL_NO_FK FOREIGN KEY REFERENCES
PURCHASE_MASTER(BILL_NO);

ALTER TABLE PURCHASE_DUE


ADD CONSTRAINT PURCHASE_DUE_SUPPLIER_ID_FK FOREIGN KEY REFERENCES
SUPPLIER(SUPPLIER_ID);

------------------------------------[8]

CREATE TABLE PRODUCT_CATEGORIES------ WOMEN,MEN, CHILDREN (SUB CATAGORY-


DRESS,SHARI,TOPS,ONE PICE
(
CATEGORIE_ID NUMBER(10) CONSTRAINT PRODUCT_CATEGORIES_CATEGORIE_ID_PK PRIMARY
KEY, ---- PK
NAME VARCHAR2(100), ---CONSTRAINT CATEGORIES_NAME_NN NOT NULL
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);
------------------------------------[9]

CREATE TABLE BRANDS


(
BRAND_ID NUMBER(10) CONSTRAINT BRANDS_BRAND_ID_PK PRIMARY KEY,(PK)
SUPPLIER_ID NUMBER(10),------(FK)
BRAND_NAME VARCHAR2(100),
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);
------
ALTER TABLE BRANDS
ADD CONSTRAINT BRANDS_SUPPLIER_ID_FK FOREIGN KEY REFERENCES SUPPLIER(SUPPLIER_ID);

------------------------------------[10]

CREATE TABLE UNITS_OF_MEASUREMENT(UOM)-----------meters or yard,PIECE


(
UNIT_TYPE_ID NUMBER(10) CONSTRAINT UNITS_OF_MEASUREMENT_UNIT_TYPE_ID_PK
PRIMARY KEY,-------(PK)
UNIT_NAME VARCHAR2(100),
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);

------------------------------------[11]

CREATE TABLE PRODUCT_SIZE


(
SIZE_ID NUMBER(10) CONSTRAINT SIZE_SIZE_ID_PK PRIMARY KEY,-------(PK)
SIZE_NAME VARCHAR2(100), ---M,L,XL,XXL
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);

---------------

------------------------------------[12]

PRODUCT SPECIFICATIONS-----------
ID NUMBER(10)
COLOUR VARCHAR2(50)
FABRIC VARCHAR2(50), ---SILK,COTTON,LILLEN
VALUE ADDITION VARCHAR2(100), ---Embroidery,MIRROR WORK,SCREENPRINT

------------------------------------[12]
CREATE TABLE PRODUCT
(
IMAGE BLOB,
PRODUCT _ID NUMBER(10) CONSTRAINT PRODUCT_PRODUCT_ID_PK PRIMARY KEY,(PK)
CATEGORY_ID NUMBER(10),---------(FK)
BRAND_ID NUMBER(10),-----(FK)
UNIT_TYPE_ID NUMBER(10),----(FK)
SIZE_ID NUMBER(10),-----(FK)
PRODUCT_NAME VARCHAR2(50),
PRODUCT_TYPE VARCHAR2(100), ----CLOTHING DRESS,BAG,SHOES,WATCH
STOCK_QTY NUMBER(10),
BUYING_PRICE NUMBER(11,2),
SELLING_PRICE NUMBER(11,2),
PRODUCT_DESC(FK) VARCHAR2(100),
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);

---------------
ALTER TABLE PRODUCT
ADD CONSTRAINT PRODUCT_CATEGORY_ID_FK FOREIGN KEY REFERENCES
PRODUCT_CATEGORIES(CATEGORY_ID);

ALTER TABLE PRODUCT


ADD CONSTRAINT PRODUCT_BRAND_ID_FK FOREIGN KEY REFERENCES BRANDS(BRAND_ID);

ALTER TABLE PRODUCT


ADD CONSTRAINT PRODUCT_UNIT_TYPE_ID_FK FOREIGN KEY REFERENCES UNITS OF
MEASUREMENT(UNIT_TYPE_ID);

ALTER TABLE PRODUCT


ADD CONSTRAINT PRODUCT_SIZE_ID_FK FOREIGN KEY REFERENCES SIZE(SIZE_ID);

------------------------------------[13]

CREATE TABLE CUSTOMER


(
CUSTOMER_ID NUMBER(10),CONSTRAINT CUSTOMER_CUSTOMER_ID_PK PRIMARY KEY,----
PK.
CUSTOMER_ NAME VARCHAR2(50),
ADDRESS VARCHAR2(50),
EMAIL VARCHAR2(50),
PHONE_NO NUMBER(20),
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);

------------------------------------[14]
CREATE TABLE SALES_MASTER
(
INVOICE_NO NUMBER(30) CONSTRAINT SALES_MASTER_INVOICE_NO_PK PRIMARY KEY,----
PK.
INVOICE_DATE DATE,
CUSTOMER_ID NUMBER(10), ---- FK
DISCOUNT_PCT NUMBER(11,2),
DISCOUNT_AMOUNT NUMBER(11,2),
TOTAL_AMOUNT NUMBER(11,2) DEFAULT 0,
VAT_PCT NUMBER(11,2),
VAT_AMOUNT NUMBER(11,2),
NET_AMOUNT NUMBER(11,2),
PAID NUMBER(11,2) DEFAULT 0,
DUE NUMBER(11,2) DEFAULT 0,
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);

---------
ALTER TABLE SALES_MASTER
ADD CONSTRAINT SALES_MASTER_CUSTOMER_ID_FK FOREIGN KEY REFERENCES
CUSTOMER(CUSTOMER_ID);

------------------------------------[15]
CREATE TABLE SALES_DETAILS
(
ID NUMBER(10)CONSTRAINT SALES_DETAILS_ID_PK PRIMARY KEY,(PK)
INVOICE _NO NUMBER(30),-------FK
PRODUCT_ID NUMBER(10),-------FK
SELLING _PRICE NUMBER(11,2),
QTY NUMBER(10),
AMOUNT NUMBER(11,2)
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);
-----------------
ALTER TABLE SALES_DETAILS
ADD CONSTRAINT SALES_DETAILS_INVOICE _NO_FK FOREIGN KEY REFERENCES SALES
MASTER(CINVOICE _NO);

ALTER TABLE SALES_DETAILS


ADD CONSTRAINT SALES_DETAILS_PRODUCT_ID_FK FOREIGN KEY REFERENCES
PRODUCT(PRODUCT_ID);

------------------------------------[16]
CREATE TABLE EXPENSE_ITEMS
(
EXPENSE_ITEM_ID NUMBER(10) CONSTRAINT EXPENSE_ITEMS_ID_PK PRIMARY KEY, -----
PK
EXPENSE_ITEM _NAME VARCHAR2(100), ----- RENT, DAILY TEA, STATIONARY
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);

---------------

------------------------------------[17]
CREATE TABLE EXPENSE
(
ID NUMBER(10) CONSTRAINT EXPENSE_ID_PK PRIMARY KEY, ----- PK
EXPENSE_ITEM_ID NUMBER(10), ----- FK
EXPENSE_DATE DATE,
QTY NUMBER(10),
AMOUNT NUMBER(11,2),
ENTRY_BY VARCHAR2(100) DEFAULT USER,
ENTRY_DATE DATE,
UPDATE_BY VARCHAR2(100) DEFAULT USER,
UPDATE_DATE DATE
);

ALTER TABLE EXPENSE


ADD CONSTRAINT EXPENSE_EXPENSE_ITEM_ID _FK FOREIGN KEY(ITEM_ID) REFERENCES
EXPENSE_ITEMS(EXPENSE_ITEMS_ID );
------------------------------------[18]

CREATE TABLE EXPENSE_TYPE


(

);

------------------------------------[19]
CREATE TABLE STOCK
(
-------------------

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy