Vous êtes sur la page 1sur 5

Basics of RDBMS

Data
Small set of information becomes data, this set of information helps make decision. Data is always some useful information.

Database
Place where you store the data. Database represents some aspect of the real world called "miniworld". A database is designed, built and populated with data for a specific purpose. It has intended group of users and some preconceived applications in which these users are interested. In other words, a database has some source from which data is derived, some degree of interaction with events in the real world and an audience that is actively interested in the contents of the database. Database can also be defined as collection of one or more tables. Ex: Mobile, human brain etc

DBMS (Database Management System)


Is a program that stores retrieves and modifies data in the database on request. Study of different techniques of design, development and maintenance of the database Types of DBMS These types are based upon their management of database structures. Types of DBMS are entirely dependent upon how the database is structured by that particular DBMS. 1. Hierarchical: A dBMS is said to be hierarchical if the relationships among the data in the database are established in such a way that one data item present as the subordinate of another one. Direct relationships exists between any 2 records that are stored consecutively. The data structure tree is followed by DBMS to structure the database. No backward movement is possible or allowed.

Ex: Dbase, Foxpro

2. Network: A DBMS is said to be in a network DBMS if the relationships among data in the database are the type many to many. Relationships among many to many appears in the form of a network. Ex: Pascal, Cobol, Fortron 3. Realational: A DBMS is said to be a relational or RDBMS if the database relationships are treated in the form of a table. A table is composed of rows and columns is used to organized the database and its structure and is actually a 2 dimension array in the computer memory. Ex: Oracle, Sybase, Informix, Sql Server, Microsoft Access

Relationship:
Logical association of any 2 tables created to preserve the data integrity is called as Relationship. Once the relationship is created, one table becomes master and other becomes child. Whatever we enter in child table has to be there in master table, otherwise the child table record will be rejected. Types of Relationships 1. One to One: One department is headed by one person. Only one person can head a department. One to Many: One salesman can serve in only one city but a city can have many sales man. Many to Many: A teacher can teach many students and a student can many teachers.

Transaction:
A transaction usually means a sequence of information exchange and its related work. A transaction is any one execution of a user program in a DBMS. Transaction is either

performed entirely or not preformed at all. Transaction should not be interfered by any other transaction. Changes made by a transaction should be permanently committed. Database should be consistent before and after any transaction. Two types --> Implicit and Explicit Implicit --> Insert, Update, Delete Explicit --> Programmed to commit like create and drop

Some More definitions: Table: Collection of rows and columns. Two dimensional structures with rows and columns.
A table is also called as an entity. A column is also called as an attribute or a field. A row is also called as a record or a tuple. A cell is the intersection of row and a column.

Constraints: These are the restrictions or conditions that are used on the columns of the
table to preserve the data correctness. Types: NOT NULL(NOT BLANK), Unique, Primary Key, Foreign Key, Check NULL --> is neither zero or blank space. It is used to represent empty values.

1. NOT NULL: This ensures that atleast some value should be present for an attribute. Can have more than one not null constraints on a table. Ex: Name cannot be left blank/NULL in a table. 2. Unique: It checks for duplicate values. A unique column can have multiple null values Ex: EMPLOYEEID/MOBILE#/MAILID should/could be unique and Not BLANK/NULL. 3. Primary Key: is used for identifying a record uniquely in a table. It is the combination of NOT NULL and UNIQUE constraints. You can have only one Primary Key is allowed per table. Ex: EmployeeID or Mobile/ MailID can be chosen as Primary key. The columns that are eligible to become PK are called Candidate Keys. A column

which is eligible to become PK but not chosen as PK is called Alternate key. CK = PK + AK AK = CK - PK If EmployeeId is chosen as primary key then, EmailId and Mobile# are considered as Alternate Keys. Together EmployeeId, EmailId and Mobile# are considered as Candidate Keys. When PK is created out of more than one column then its called as composite PK. 4. Check: Check is used for enforcing some additional conditions with respect to Business requirement. Ex: SAL > 3000, AGE > 14 5. Foreign Key: It is a referential integrity constraint which creates the relationship between the tables. To create a FK in a child table, master table should have PK on the common column. Composite PK in master table is used as composite FK in child table. Foreign key can take both NULL and duplicate values. There can be more than one FK per table. Ex: Deptno from DEPT table to Deptno in Employee table.

Here in the above picture, 1 --> Row or a Record or a Tuple 2 --> Column or a Attribute or a Field This is also a primary key from the examples we have discussed so far 3 --> Its a column with a NOT NULL constraint and Check constraint to be > 0 4 --> Its a column, having referential integrity constraint called as Foreign key 5 --> Its a CELL, intersection between row and a column having NULL value 6 --> Its a CELL, having some value

Vous aimerez peut-être aussi