SIGN IN YOUR ACCOUNT TO HAVE ACCESS TO DIFFERENT FEATURES

FORGOT YOUR PASSWORD?

FORGOT YOUR DETAILS?

AAH, WAIT, I REMEMBER NOW!
Openbaraza

Openbaraza

Openbaraza

Baraza is a Swahili word that means a deliberation meeting held by a collective group of people with wisdom.

T : +254 (20) 2243097 / 2227100
Email: info@openbaraza.org

OPENBARAZA
Dew CIS Solutions LTD Barclays Plaza, 12th Floor. Loita Street.

Open in Google Maps
  • Framework
  • Projects
    • Human Resource
      • Human Resource
      • Time Attendance
      • Project Planning
    • Finance Management
      • Business
      • Payroll
    • Investment Management
      • Banking
      • Chama
      • Sacco
    • Case Management
      • Judiciary
    • Real Estate Management
      • Property
    • Academic Management
      • UMIS
      • Schools
  • Forums
    • HCM HR Payroll
    • Business
    • Sacco
    • Banking
  • Blog & News
    • OpenBaraza Framework
    • Databases
    • Java Programming
    • Scrum
  • Contact Us

Operations Of a Database

by dennis@dennis.me.ke / Wednesday, 07 November 2018 / Published in Databases

Let’s take a real-life example that could use a database in its daily operations. A friend started a small business of selling lady undergarments. It being a small business, an excel sheet was enough to keep her records where she updated the data weekly. The data looked a little something like this.

Overtime with the growth of the business, data grew and was too much to be input on an excel sheet weekly. Some transactions were not recorded hence the math was not adding up. With the help of a database, her work would have been easier.
So, back to the main question …what a database is and what does it do?

Here is some of the required information she needs from the data in the spreadsheet:

  • Current stock.
  • Frequent customers.
  • The fast moving product.

Let’s have a relational diagram

Using SQL commands to retrieve information.
Let’s create a database called garments:

CREATE DATABASE garments;
After creating the database we are going to create various tables under the database.

These are the tables we are going to create; products, transactions, customers;

Create Products table
CREATE TABLE products (
product_id serial primary key,
product_name varchar(50) not null,
stock_status integer not null,
product_price real not null
);

Inserting data in the Products table
INSERT INTO products (product_id, product_name, stock_status, product_price) VALUES
(1, 'Cotton Underwear', 1, 200),
(2, 'Lace Underwear', 1, 300),
(3, 'Brassier', 1, 400);

Create Customers table
CREATE TABLE customers (
customer_id serial primary key,
customer_name varchar(50) not null,
details text
);

Inserting data in customers table
INSERT INTO customers (customer_id, customer_name) VALUES
(1, 'Mary'),
(2, 'Joyce'),
(3, 'Esther');

Creating the Purchases table
CREATE TABLE purchases (
purchase_id serial primary key,
product_id integer references products,
quantity integer not null,
purchase_price real not null,
purchase_date date default current_date
);

Inserting data in purchases table
INSERT into purchases(product_id, quantity, purchase_price, purchase_date) VALUES
(3, 40, 650, '2018-08-09'),
(2, 60, 500, '2018-03-11'),
(1, 70, 150, '2018-04-20');

Creating the sales table
CREATE TABLE sales (
sale_id serial primary key,
product_id integer references products,
customer_id integer references customers,
quantity integer not null,
sale_price real not null,
sale_date date default current_date
);

Inserting data in the sales table
INSERT into sales(product_id, customer_id, quantity, sale_price, sale_date) VALUES
(3, 3, 3, 200, '2018-09-20'),
(1, 2, 5, 500, '2018-10-13'),
(2, 1, 5, 350, '2018-10-15');

From this information we want solve some of the business persons’ issues
For instance knowing;

  • customer variation
  • Product Variation
  • Current Stock

</em

Businesses would be healthier and more productive if they invested more in having a database. We should embrace digitization in our businesses especially when it comes to the storing of data and records.

2
  • Tweet

About dennis@dennis.me.ke

What you can read next

Introduction to Databases
Structured Query Language -(SQL)

1 Comment to “ Operations Of a Database”

  1. Douglas Li says :Reply
    November 20, 2018 at 7:56 am

    Great Idea

Leave a Reply to Douglas Li Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • 08. BODMAS IN JAVA

  • 07. JAVA ARRAYS: Store Student Details Using Arrays and List

  • 06. Classes: Store Student Details Using Json Format

  • 02. SPRINT RETROSPECTIVE

  • 01. SCRUM (DEMO)

Categories

  • Databases
  • Java Programming
  • OpenBaraza Framework
  • Scrum

QUICK LINKS

  • Home
  • Our Stories
  • Contact Us
  • Terms and Conditions
  • Our Policy

VISIT US

Open Baraza
Barclays Plaza, 12th Floor.
Loita Street, Nairobi.

Open in Google Maps

GET IN TOUCH

Tel: +254 (20) 2243097 / 2227100
     +254(726)209214, +254(738)819505
Email: info@openbaraza.org

Follow Us

Could not authenticate you.
  • GET SOCIAL
Openbaraza

© All rights reserved | Open Baraza developed by DewCis Solutions.

TOP