Employee Designation Table In Oracle Apps
Summary: this tutorial introduces you to an Oracle sample database and provides you with the links for you to download it.
Note that this tutorial explains you the Oracle Sample Database. It doesn't show you how to create this sample database in Oracle. To create this database for practicing, you follow the creating the Oracle Sample Database tutorial.
Introduction to the OT Oracle sample database
We provide you with an Oracle sample database named OT which is based on a global fictitious company that sells computer hardware including storage, motherboard, RAM, video card, and CPU.
The company maintains the product information such as name, description standard cost, list price, and product line. It also tracks the inventory information for all products including warehouses where products are available. Because the company operates globally, it has warehouses in various locations around the world.
The company records all customer information including name, address, and website. Each customer has at least one contact person with detailed information including name, email, and phone. The company also places a credit limit on each customer to limit the amount that customer can owe.
Whenever a customer issues a purchase order, a sales order is created in the database with the pending status. When the company ships the order, the order status becomes shipped. In case the customer cancels an order, the order status becomes canceled.
In addition to the sales information, the employee data is recorded with some basic information such as name, email, phone, job title, manager, and hire date.
Oracle sample database diagram
The following illustrates the sample database diagram:
Table Names | Description | Records |
---|---|---|
CONTACTS | store contact person information of customers | 319 records |
COUNTRIES | store country information | 25 records |
CUSTOMERS | store customer master | 319 records |
EMPLOYEES | store employee master | 107 records |
INVENTORIES | store inventory information of products | 1112 records |
LOCATIONS | store locations of warehouses | 23 records |
ORDERS | store order header information | 105 records |
ORDER_ITEMS | store order line items | 665 records |
PRODUCT_CATEGORIES | store product categories | 5 records |
PRODUCTS | store product information | 288 records |
REGIONS | store regions where the company operates | 4 records |
WAREHOUSES | store warehouse information | 9 records |
Download Oracle Sample database
Download the following sample database in zip file format:
Download Oracle Sample Database
After downloading the file, you should extract it. The zip file contains the following *.sql
files:
ot_create_user.sql
is for creating OT user and grant privilegesot_schema.sql
is for creating database objects such as tables, constraints, etc.ot_data.sql
is for loading data into the tables.ot_drop.sql
is for removing all objects in the sample database.
The following illustrates the statements for creating the database objects.
Code language: SQL (Structured Query Language) ( sql )
CREATE TABLE regions ( region_id NUMBER GENERATED BY DEFAULT AS IDENTITY START WITH 5 PRIMARY KEY, region_name VARCHAR2( 50 ) NOT NULL ); -- countries table CREATE TABLE countries ( country_id CHAR( 2 ) PRIMARY KEY , country_name VARCHAR2( 40 ) NOT NULL, region_id NUMBER , -- fk CONSTRAINT fk_countries_regions FOREIGN KEY( region_id ) REFERENCES regions( region_id ) ON DELETE CASCADE ); -- location CREATE TABLE locations ( location_id NUMBER GENERATED BY DEFAULT AS IDENTITY START WITH 24 PRIMARY KEY , address VARCHAR2( 255 ) NOT NULL, postal_code VARCHAR2( 20 ) , city VARCHAR2( 50 ) , state VARCHAR2( 50 ) , country_id CHAR( 2 ) , -- fk CONSTRAINT fk_locations_countries FOREIGN KEY( country_id ) REFERENCES countries( country_id ) ON DELETE CASCADE ); -- warehouses CREATE TABLE warehouses ( warehouse_id NUMBER GENERATED BY DEFAULT AS IDENTITY START WITH 10 PRIMARY KEY, warehouse_name VARCHAR( 255 ) , location_id NUMBER( 12, 0 ), -- fk CONSTRAINT fk_warehouses_locations FOREIGN KEY( location_id ) REFERENCES locations( location_id ) ON DELETE CASCADE ); -- employees CREATE TABLE employees ( employee_id NUMBER GENERATED BY DEFAULT AS IDENTITY START WITH 108 PRIMARY KEY, first_name VARCHAR( 255 ) NOT NULL, last_name VARCHAR( 255 ) NOT NULL, email VARCHAR( 255 ) NOT NULL, phone VARCHAR( 50 ) NOT NULL , hire_date DATE NOT NULL , manager_id NUMBER( 12, 0 ) , -- fk job_title VARCHAR( 255 ) NOT NULL, CONSTRAINT fk_employees_manager FOREIGN KEY( manager_id ) REFERENCES employees( employee_id ) ON DELETE CASCADE ); -- product category CREATE TABLE product_categories ( category_id NUMBER GENERATED BY DEFAULT AS IDENTITY START WITH 6 PRIMARY KEY, category_name VARCHAR2( 255 ) NOT NULL ); -- products table CREATE TABLE products ( product_id NUMBER GENERATED BY DEFAULT AS IDENTITY START WITH 289 PRIMARY KEY, product_name VARCHAR2( 255 ) NOT NULL, description VARCHAR2( 2000 ) , standard_cost NUMBER( 9, 2 ) , list_price NUMBER( 9, 2 ) , category_id NUMBER NOT NULL , CONSTRAINT fk_products_categories FOREIGN KEY( category_id ) REFERENCES product_categories( category_id ) ON DELETE CASCADE ); -- customers CREATE TABLE customers ( customer_id NUMBER GENERATED BY DEFAULT AS IDENTITY START WITH 320 PRIMARY KEY, name VARCHAR2( 255 ) NOT NULL, address VARCHAR2( 255 ) , website VARCHAR2( 255 ) , credit_limit NUMBER( 8, 2 ) ); -- contacts CREATE TABLE contacts ( contact_id NUMBER GENERATED BY DEFAULT AS IDENTITY START WITH 320 PRIMARY KEY, first_name VARCHAR2( 255 ) NOT NULL, last_name VARCHAR2( 255 ) NOT NULL, email VARCHAR2( 255 ) NOT NULL, phone VARCHAR2( 20 ) , customer_id NUMBER , CONSTRAINT fk_contacts_customers FOREIGN KEY( customer_id ) REFERENCES customers( customer_id ) ON DELETE CASCADE ); -- orders table CREATE TABLE orders ( order_id NUMBER GENERATED BY DEFAULT AS IDENTITY START WITH 106 PRIMARY KEY, customer_id NUMBER( 6, 0 ) NOT NULL, -- fk status VARCHAR( 20 ) NOT NULL , salesman_id NUMBER( 6, 0 ) , -- fk order_date DATE NOT NULL , CONSTRAINT fk_orders_customers FOREIGN KEY( customer_id ) REFERENCES customers( customer_id ) ON DELETE CASCADE, CONSTRAINT fk_orders_employees FOREIGN KEY( salesman_id ) REFERENCES employees( employee_id ) ON DELETE SET NULL ); -- order items CREATE TABLE order_items ( order_id NUMBER( 12, 0 ) , -- fk item_id NUMBER( 12, 0 ) , product_id NUMBER( 12, 0 ) NOT NULL , -- fk quantity NUMBER( 8, 2 ) NOT NULL , unit_price NUMBER( 8, 2 ) NOT NULL , CONSTRAINT pk_order_items PRIMARY KEY( order_id, item_id ), CONSTRAINT fk_order_items_products FOREIGN KEY( product_id ) REFERENCES products( product_id ) ON DELETE CASCADE, CONSTRAINT fk_order_items_orders FOREIGN KEY( order_id ) REFERENCES orders( order_id ) ON DELETE CASCADE ); -- inventories CREATE TABLE inventories ( product_id NUMBER( 12, 0 ) , -- fk warehouse_id NUMBER( 12, 0 ) , -- fk quantity NUMBER( 8, 0 ) NOT NULL, CONSTRAINT pk_inventories PRIMARY KEY( product_id, warehouse_id ), CONSTRAINT fk_inventories_products FOREIGN KEY( product_id ) REFERENCES products( product_id ) ON DELETE CASCADE, CONSTRAINT fk_inventories_warehouses FOREIGN KEY( warehouse_id ) REFERENCES warehouses( warehouse_id ) ON DELETE CASCADE );
In this tutorial, we have introduced you the Oracle sample database and shown you how to download it. Now, you should be ready to create the sample database in your Oracle database server for practice.
Was this tutorial helpful?
Employee Designation Table In Oracle Apps
Source: https://www.oracletutorial.com/getting-started/oracle-sample-database/
Posted by: hardertraturness.blogspot.com
0 Response to "Employee Designation Table In Oracle Apps"
Post a Comment