Relational Database Systems - An Intro

Last updated 24 Oct 2015 . 3 min read



https://img.sheroes.in/img/default_img.jpg https://img.sheroes.in/img/default_img.jpg

If your hands are full of dough and you need to move the screen right instantly ,what should you do?

Just move your hand to the right and yes, you don’t have to touch it. Apart from this, Intel has come up with wireless ‘Charging’ for your laptops and devices and clipping of the background if you are in a cluttered background and conferencing, which were displayed in ‘Asia’s largest tech show’ Computex in Taiwan.

Now answers to last month’s article.

One Customer can have many accounts and one Account can be owned by two people too.

Smitha  with Customer Number C0100 has three accounts as shown in figure 2 above.

She uses the A0123 and A0777 for personal and B5677 for business purposes.

B5677 is also co- owned by her husband Travolta with Customer Number C5600. Account B5677 has more than one owner. Therefore one Customer Smitha can have many accounts; One Account B5677 has more than one owner. Thus the relationship between Customers table and Accounts table is ‘ many to many’.

Smitha shops at Fabindia and Chocolate room with account A0123.One Account A0123 can have many transactions. The relationship between Account table and Transactions table is ‘one to many’. But each transaction is related to one account only.

Some sample Records of TRANSACTION table is demonstrated in figure 2 above .The columns are in the orders of Transaction number, Customer number, Account number ,Amount transacted, Description ,Date of transaction and Balance.

As can be seen Smitha with Customer Number C0100 has transacted thrice on 01/May/2014, 04/May2014 and 05/May/2014 .She has transacted with A0123 account and B5677 which is partnership account with her husband. Travolta with Customer Number C5600 has transacted with account B5677 on 05/May/2014.Therefore, one customer Smitha can transact with many accounts she holds. One account B5677 can be transacted on by many(two) customers Smitha and Travolta.

As can be seen the transactions are ordered by the column transaction number.(refer figure 3)

The CUST_AC table holds information about which account belongs to which customer. Therefore if we need to send mailers to certain account holders, the dispatcher just needs to know which account belongs to which customer and just the address of that customer. This means and ensures he gets access to CUST_AC and CUSTOMERS table only.

In a relational model each table has a primary key which sets the relation with the foreign key of another table. Customer_no column of Customer table sets the relationship with transaction table where customer number column is the foreign key. The columns within each table for eg CUSTOMER table are related to each other. Each table in a database schema holds a relationship with another or each other. Thus, the term relational database management systems is given.

But what is one to one relationship? It is like child-father. Only one on one.

How to query this table?

Example, how to get only that rows specific to Smitha?

How to get only that rows that are specific to Smitha and Travolta?

How to get the total sum transacted that day by Smitha?

Can amount in transactions be negative? How to set business rules.?

We will see that next.

 

 


kanchana_june article
Kanchana Selvakumar
Kanchana is a passionate Creative Writer. She has immense interest in visualising technology through creativity. Her creative technical articles are posted at OradbaIndia . She is basically an electronics engineer with 15+ years of Information Technology experience which includes working as a freelancer and remote working. She is also passionate about English Poetry. Poetry including picture poetry can be read P4Poetry .If not in the vast world of software and systems, she likes to be lost in the exciting tiny world of her kids.


Share the Article :

Similar Articles You love
Download App

Get The App

Experience the best of SHEROES - Download the Free Mobile APP Now!