How to design a relational database?

Asked By 230 points N/A Posted on -
qa-featured

Hi there, I am a designer and I’d like to create a relational database which has a life cycle of many stages.  I understand that the life cycle of relational database is the cycle of changes and development.

Could anyone explain me that several stages of the life cycle so that I could design a good relational database which has some certain problems in that field.

SHARE
Best Answer by JaySoftCenter
Answered By 5 points N/A #86088

How to design a relational database?

qa-featured

Some guidelines are suggested here about the designing of relational database.

Step 1.

The customer table with primary key is created. Since the relational database is related to a customer and its orders, the primary key is CustomerID.  This primary key has to be specific and unique so that incrementing integer is making a good candidate.

To create Table Customer, the code is as follows.

(CustomerID int identity (100,1) primary key,

First_Name varchar (50))

Step 2.

Then the order table with foreign key is created. This foreign key is created in Step 1 i.e. the column of CustomerID.  Then two tables are linked by this constraint.
Create table order (OrderID int, CustomerID int references Customer (CustomerID))

Step 3.

The relationship and the establishment of referential integrity have to be tested.  Try to run a command Delete to test the above.  The steps are as follows.

Run the command on table Customer located on SQL Server.

‘Delete from Customer where CustomerID=1’

The database on SQL Server will return an error that because of 'Referential Constraints' query cannot be deleted.

Best Answer
Best Answer
Answered By 0 points N/A #86089

How to design a relational database?

qa-featured

Hi Kioko_victor,

All you have to do is to follow these steps on how to create a relational database.

Let us assume you have:
Database name: Dbase
Table name: tbluser
fields: ID, username, password
Table name: tbladdusers
fields: ID, lastname firstname, address and so forth…

Here's how to relate tables in a database. Assuming again that you are using a database Ms Access,
First, open Ms Access,
1. Go to Tools-> Relationship and show both tables name: tbluser and tbladdusers
2. Select the ID of the tbluser and drag it into tbladdusers
3. Click on "Create" button that pops- up
4. This is called a relationship, in particular a 'one to many' relationship. For each ID in tbluser there are MANY related ID's in tbladdusers.
5. Access now understands how the two tables are connected and this gives you a good advantage.

Hope it will help you connect two tables with relationships.

Related Questions