Thursday, March 4, 2010

Part 3


Contiue from part 2 ---
My question is from where should we start if I have to do  Database testing?
My answer is first understand dataBase schema ( schems means – the way database tables are designed)
Let me give you the answer to understand the database schema.
We  have a Database that is relational database management system(RDBMS).Here Relational means it has a relation with something .That means each table in database has a relation to other table. This relation is possible with the help of Primary Key and foreign key.
primary key is a name of column that must have different values  in every rows of records.
Here is some facts of Primary key 

Primary key is a name of column that must have different values  in every rows of records.
Here is some facts of Primary key
·         Primary key is a name of  column of a table
·         Every row ot primary key column has distinct vlaue
Generally the name of primary key column is table name followd by ID. Like in employee table , primary key would be employeeid , in person table it would be persondid and so on .
Foreign key – Foreign key in Table A is  a primary key  of Table B.
Foreign key allows us to make the relation between tables ( we talked earlier about the relation ) and make the database normalized.
To understand the concept of  primary key and Foreign key , I have created a Db schema for Defect life cycle( As we all are famliar with this) 
(Click on diagram to see bigger )

And hence forth I will use this schema to write SQL and give you the scenrio based sql .Things that are in Green in a rectangle are Table Name and below that its column name.I have also maked a relation ship between the diffenent table by an arrow.Based on the above defination of Primary key and foreign key , I can tell that In Defect table , Defectid is primary key (Table Name followed by ID) and all other id columns are foreign key ( primary key of other table).

In general when ever we see a colum name as ID that might be either primary key or foreign key  and further primary key is table name followed by id.

No comments:

Post a Comment