0% found this document useful (0 votes)
307 views

Unit - 1 - Database Concepts

The document discusses database concepts including data, information, databases, DBMS, relational databases, keys, constraints, DDL, and DML. A database is a collection of interrelated data stored together to serve multiple applications. A DBMS is responsible for storing, manipulating, maintaining and utilizing databases. Relational databases organize data into tables with rows and columns. Keys like primary keys and foreign keys are used to uniquely identify records and define relationships between tables.

Uploaded by

VISHWA PRIYA I
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
307 views

Unit - 1 - Database Concepts

The document discusses database concepts including data, information, databases, DBMS, relational databases, keys, constraints, DDL, and DML. A database is a collection of interrelated data stored together to serve multiple applications. A DBMS is responsible for storing, manipulating, maintaining and utilizing databases. Relational databases organize data into tables with rows and columns. Keys like primary keys and foreign keys are used to uniquely identify records and define relationships between tables.

Uploaded by

VISHWA PRIYA I
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Unit - 1: Database Concepts

Data :
➢ Data is a collection of raw facts which have not been processed to reveal
useful information.

Information:
➢ It is produced by processing of data.

Database:
➢ May be defined as a collection of interrelated data stored together to serve
multiple applications.
➢ It is a computer based record keeping system.
➢ It not only allows to store but also allows us modification of data as per
requirements.

DBMS :
➢ A DBMS refers to the Database Management System.
➢ It is a software that is responsible for storing,manipulating, maintaining and
utilizing databases.
➢ A database along with a DBMS is referred to as a database system.
➢ DBMS softwares are : Oracle, MySQL , Sybase, SQLite, etc..

Purpose of DBMS:
➢ Database reduces Redundancy (Reduction in Redundancy):
It removes duplication of data because data is kept at one place and all
the application refers to the centrally maintained database.
➢ Database controls Inconsistency (Improved Consistency:
When two copies of the same data do not agree to each other, then it is
called Inconsistency. By controlling redundancy, the inconsistency is also
controlled.
➢ Database facilitate sharing of Data(Improved Availability):
Data stored in the database can be shared among several users.
➢ Database ensures Security (Improved Security):
Data is protected against accidental or intentional disclosure to
unauthorized persons or unauthorized modification.
➢ Database maintains Integrity:
It enforces certain integrity rules to insure the validity or correctness
of data. For Example. A date cannot be like 25/25/2000.
➢ Database enforces Standard:
Database is maintained in a standard format which helps to data
interchange or migration of data between two systems.
➢ User Friendly:
Using a DBMS. it becomes very easy to access, modify and delete
data. It reduces
the dependency of users on computer specialists to perform various dara
related operations in a DBMS because of its user friendly interface.

Limitations of using DBMS:


➢ High Cost
➢ Security and Recovery Overheads

Relational Database:

➢ In relational databases model data is organized into tables. (i.e. rows and
columns).
➢ These tables are also known as relations.
➢ A row in a table represents relationships among a set of values.
➢ A column represents the field/attributes related to the relation under which
information will be stored.
➢ For Example, If we want to store details of a student then: Roll_No, Name,
Class, Section, etc. will be the column/attributes and the collection of all the
column information will become a Row/Record.

Various terms in the Relational Database:

Relation (Table):
➢ A Relation or Table is Matrix like structure arranged in Rows or Columns.
Domain:
➢ The data type of values in each column is called the Domain.

Tuple/ Entity / Record:


➢ Row of a table is called Tuple or Record.

Attribute / Field:
➢ Column of a table is called Attribute or Field.

Degree:
➢ Number of columns (attributes) in a table.

Cardinallity :
➢ Number of rows (record) in a table.

Concept of Keys:
➢ In relation each record must be unique. i.e no two identical records are
allowed in the database. A key attribute identifies the record and must have
unique values. There are various types of Keys:

Primary Key, Candidate Key, Alternate Key and Foreign Key

Primary Key:

➢ A set of one or more attribute that can identify a record uniquely in the
relation is called Primary Key
➢ There can be only 1 primary key in a table.
➢ Allows only distinct (no duplicate) values and also forces mandatory entry
(Not Null). i.e. we cannot leave it blank.

Candidate Key:
➢ In a table there can be more than one attribute which contains unique values.
These columns are known as candidate key as they are the candidate for
primary key.
➢ Among these database analysts select one as a primary key based on
requirements like must contain unique value, compulsory entry and where
maximum searching is done etc.

Alternate Key:

➢ In case of multiple candidate keys, one of them will be selected as Primary


key and the rest of the column will serve as Alternate Key.
➢ A candidate Key which is not a primary key is an Alternate Key.

Foreign Key:
➢ Used to create relationships between two tables.
➢ It is a non-key attribute whose value is derived from the Primary key of
another table.
➢ Foerign key column will be the value in the Primary key of another table, if
present then entry will be allowed otherwise data will be rejected.
➢ Primary key column table from which values will be derived is known as
Primary Table or Master Table or Parent Table.
➢ Foregin key column table will be Foreign Table or Detail Table or Child
Table.

Super Key:
➢ A superkey is a group of single or multiple keys which identifies rows in a
table. A Super key may have additional attributes that are not needed for
unique identification.

Relational Model Constraints:


A contriants refers to the condition or limitation we apply on any column so that
only correct information will be entered in the table.

Types of Constraints:
Primary Key Constraint , Unique Constraint, Not Null Constraint, Default
Constraint, Check Constraint

Primary Key Constraint:

➢ Ensuring unique value in any column also forces data entry mandatory. only
one primary key can be applied in one table.

Unique Contraints:
➢ also allows unique value in any column but it allows NULL values and can
be applied to n times.

Not Null Constraint:


➢ it will make data entry mandatory for the applied column. i.e. NULL will not
be allowed.

Check Constraint:
➢ allows to specify a range of values that can be entered in an applied column
like salary must be greater than 2000, marks must be greater than 0 or dept
must be in a given list of values etc. Note: in mysql the database engine
will ignore the check constraints.

Default Constraint:
➢ it allows to specify any value which will be automatically inserted in applied
column if we not specify applied column at the time of data entry using
INSERT

DATA DEFINITION LANGUAGE:

➢ It allows you to create database objects like creating a table, view or any
other database objects.
➢ The information about created objects are stored in special file called DATA
DICTIONARY
➢ DATA DICTIONARY contains metadata i.e. data about data.
➢ While creating a table DDL allows to specify – name of table, attributes,
data types of each attribute, may define range of values that attributes can
store, etc
➢ Major commands of DDL are – CREATE, ALTER, DROP

DATA MANIPULATION LANGUAGE :


➢ It allows to perform following operation on table
✓ Retrieval of information stored in table
✓ Insertion of new data in table
✓ Modification of existing data in table
✓ Deletion of existing data from table

Main DML commands are – SELECT, INSERT, UPDATE AND DELETE

DDL Commands:

1) Create database command is used to create a new database.


2) Create Table command is used to create a new table or relation.
3) Show databases command is used to check the list of databases that currently
exist on the server.
4) Show tables command is used to display all the tables created in the current
database.
5) Drop table command is used to delete tables in the current database.
6) Drop database command is used to delete databases on the server.
7) Alter table command is used to modify the base table definition. The
modifications that can be done using this command are: a) Adding a column b)
Dropping a column c) Altering a Column d) Dropping keys e) Adding a
constraint

You might also like