Database or DBMS ( Database Mangement system) It is a collection of multiple tables. OR collection of logically related data. OR It is computerized record keeping information system. Examples of DBMS software are Dbase, Foxpro, Oracle, MS SQL Server, MS Access, Paradox, DB2, FileMaker and MySQL etc.
is a collection of organized DATA/INFORMATION It works like a container which contains the various object like Tables, Queries, Reports Data is organized into rows, columns i.e. in the tables form DATABASE
Different types of Databases RDBMS -(Relational Database management system). e.g. MS Access, MySQL, Microsoft SQL Server, IBM DB2 ORDBMS - Object Relational Database management system. e.g. Oracle
WHY DO WE NEED DATABASE? OR ADVANTAGES OF DATABASE reduces Redundancy (duplication) Provides Security facilitate Sharing of Data maintains Integrity ( rules /condition )
RELATIONAL DATABASE It is a collective set of multiple data sets organized by tables, records and columns It establishes a well- defined relationship between database tables It uses Structured Query Language (SQL), SQL- is a standard user application that provides an easy programming interface for database interaction.
Relation : Student Rollno Admno Name Stream Phone 1 12/345 Teena Science 234567879 2 14/564 Sheena Commerce 344553322 3 10/345 Heena Science 23455632 4 11/456 Meena Science 345522356 5 13/432 Leena Humanities 456720980 6 3/567 Reena Commerce 456322578 Relation - Relation is a collection of rows and columns . It is also called Table.
Relation : Student Rollno Admno Name Stream Phone 1 12/345 Teena Science 234567879 2 14/564 Sheena Commerce 344553322 3 10/345 Heena Science 23455632 4 11/456 Meena Science 345522356 5 13/432 Leena Humanities 456720980 6 3/567 Reena Commerce 456322578 Attribute/field/column A column in a relation is called an attribute. It is also termed as field or column.
Relation : Student Rollno Admno Name Stream Phone 1 12/345 Teena Science 234567879 2 14/564 Sheena Commerce 344553322 3 10/345 Heena Science 23455632 4 11/456 Meena Science 345522356 5 13/432 Leena Humanities 456720980 6 3/567 Reena Commerce 456322578 Degree No of columns/attributes in a relation Degree is 5
Relation : Student Rollno Admno Name Stream Phone 1 12/345 Teena Science 234567879 2 14/564 Sheena Commerce 344553322 3 10/345 Heena Science 23455632 4 11/456 Meena Science 345522356 5 13/432 Leena Humanities 456720980 6 3/567 Reena Commerce 456322578 Tuple/Record - A row in a relation is called a tuple. OR – Collection of fields in a relation
Relation : Student Rollno Admno Name Stream Phone 1 12/345 Teena Science 234567879 2 14/564 Sheena Commerce 344553322 3 10/345 Heena Science 23455632 4 11/456 Meena Science 345522356 5 13/432 Leena Humanities 456720980 6 3/567 Reena Commerce 456322578 Cardinality - No of rows/record/tuples in a relation Cardinality is 6
Relation : Student Rollno Admno Name Stream Phone 1 12/345 Teena Science 234567879 2 14/564 Sheena Commerce 344553322 3 10/345 Heena Science 23455632 4 11/456 Meena Science 345522356 5 13/432 Leena Humanities 456720980 6 3/567 Reena Commerce 456322578 Domain It is pool of values from which the value is derived for a column. Science Commerce Humanities
RELATIONAL DATABASE TERMS
KEYS IN A DATABASE it is used for identifying unique rows from table & establishes relationship among tables on need.
KEYS IN A DATABASE Primary Key Candidate Key Alternate Key- Foreign Key
Primary Key Primary key is a key that can uniquely identifies the records/tuples in a relation. This key can never be duplicated and NULL. Relation : Student Rollno Admno Name Stream Phone 1 12/345 Teena Science 234567879 2 14/564 Sheena Commerce 344553322 3 10/345 Heena Science 23455632 4 11/456 Meena Science 345522356 5 13/432 Leena Humanities 456720980 6 3/567 Reena Commerce 456322578 Rollno can be primary key
Candidate Key - which can serve as a primary key but not primary key. it is also called alternate key Relation : Student Rollno Admno Name Stream Phone 1 12/345 Teena Science 234567879 2 14/564 Sheena Commerce 344553322 3 10/345 Heena Science 23455632 4 11/456 Meena Science 345522356 5 13/432 Leena Humanities 456720980 6 3/567 Reena Commerce 456322578 admno can be candidate key
Alternate Key- Out of all candidate keys, only one gets selected as primary key, remaining keys are known as alternate or candidate key Relation : Student Rollno Admno Name Stream Phone 1 12/345 Teena Science 234567879 2 14/564 Sheena Commerce 344553322 3 10/345 Heena Science 23455632 4 11/456 Meena Science 345522356 5 13/432 Leena Humanities 456720980 6 3/567 Reena Commerce 456322578 admno can be alternate key/ candidate key
Foreign Key- Foreign Key is a key that is defined as a primary key in some other relation. Relation : Student Rollno Admno Name Stream Phone Tno 1 12/345 Teena Science 234567879 T1 2 14/564 Sheena Commerce 344553322 T1 3 10/345 Heena Science 23455632 T2 4 11/456 Meena Science 345522356 T2 5 13/432 Leena Humanities 456720980 T3 6 3/567 Reena Commerce 456322578 T2 Relation : Test Tno Tname dateofexam T1 UT1 2/4/2020 T2 HY 3/9/2020 T3 UT2 5/11/2020 T4 Annual 9/1/2021 FOREIGN KEY