Dbms Study Material
Dbms Study Material
Well known DBMSs include Oracle, IBM DB2, Microsoft SQL Server, MicrosoftAccess,
openoffice.org Base,PostgreSQL, MySQL, FoxPro, and SQLite.(below picture for the better
understanding of database and DBMS)
1
Data can be organized into two types:
Flat File : Data is stored in a single table. Usually suitable for less amount of data.
Relational : Data is stored in multiple tables and the tables are linked using a common
field. Relational is suitable for medium to large amount of data.
Database Servers
Database servers are dedicated computers that hold the actual databases and run only the
DBMS and related software.
database servers are accessed through command line or graphic user interface tools
referred to as Frontends.
database servers are referred to as Back-ends. Such type of data access is referred to as a
client-server model.
Advantages of Database
Reduces Data Redundancy
Sharing of Data
Data Integrity
Data Security
Privacy
Backup and Recovery
Data Consistency
Reduces Data redundancy
occurs when the same piece of data is stored in two or more separate places, data redundancy
can cause data inconsistency.
This is prevented in a database as there is a single database and any change in it is reflected
immediately. Because of this, there is no chance of encountering duplicate data.
Sharing of Data
The ability to share the same data resource with multiple applications or users.
Data sharing is a primary feature of a database management system (DBMS).
Data integrity
Data integrity is normally enforced in a database system by a series of integrity constraints or
rules.
Data integrity means that the data is accurate and consistent in the database. Data Integrity is
very important as there are multiple databases in a DBMS.
2
Data Security
. Only authorized users should be allowed to access the database and their identity should be
authenticated using a username and password. Unauthorized users should not be allowed to
access the database under any circumstances as it violates the integrity constraints.
Privacy
The privacy rule in a database states that only the authorized users can access a database
according to its privacy constraints. For example - In social networking sites, access constraints
are different for different user.
Backup and Recovery
Database Management System automatically takes care of backup and recovery. The users don't
need to backup data periodically because this is taken care of by the DBMS. Moreover, it also
restores the database after a crash or system failure to its previous condition
Data Consistency
Data consistency is ensured in a database because there is no data redundancy.
Data Consistency means there should be multiple mismatching copies of the same data. All data
appears consistently across the database and must be same for all the users viewing the
database.
Features of Database
Database stores data or information in the form of tables .just like the one below
Table can store small record to billions of records in the data base.
Record or Tuple: Each row is called as a record, it is the information about the one item
or thing (Here it is about one student)
3
Value:It is the actual text, number, date.. etc. You put in while adding information to
your database. (Here in the student data base 3, c, 9 ,kuvempunar, 4/4/2110 are the
values)
Important Terms :
1) Primary Key : A primary key is a unique value that identifies a row in a table. It helps
the database to search for a record.
2) Composite Primary Key : When primary key constraint is applied on one or more
columns then it is known as Composite Primary Key.
3) Foreign key : The foreign key identifies a column or set of columns in one
(referencing) table that refers to a column or set of columns in another (referenced) table.
Referenced table or
parent table
Foreign key
Referencing table
or child table
A relational database is a collective set of multiple data sets organized by tables, records
and columns. Relational database establish a well-defined relationship between database
tables.
A Relational database use Structured Query Language (SQL), which is a standard user
application that provides an easy programming interface for database interaction.
4
ASSESSMENT
Q4. State the relationship and difference between a primary and foreign key?
Ans. Primary key and Foreign key are used to relate the tables so that data can be fetched
from multiple tables.
We can not enter duplicate values in Primary key while duplicate values can be entered in
Foreign Key.
5
SESSION-2 : CREATE AND EDIT TABLES USING WIZARD & SQL COMMANDS
7. Data types are used to identify which type of data we are going to store in the database.
8. Data types in Open Office base are broadly classified into five categories.
9. By default all the fields will have Text [VARCHAR] data type.
10. Files of any format can be stored using the Binary data types.
11. Time stamp stores date and time information.
Short Answer Questions
1. In how many ways tables can be created in Base?
Ans: Table can be created in two ways
1) In design view
2) Using wizard
2.Why are data types used in DBMS /RDBMS?
Ans : Data types are used to identify which type of data(value) we are going to store in the data-
base.
Fields themselves can be of different types depending on the data they contain.
Ans. A row is also called a Record or Tuple, represents a single data item in a table.
A column or field is called attribute, which is a set of data values of a particular simple ype.
Longvarbinary
Binary
Varbinary
7
SESSION-3: PERFORM OPERATIONS ON TABLE
1) The types of languages used for creating and manipulating the data in the Database
are DDL & DML.
2) A DDL is a standard for commands that define the different structures in a database.
3) A DML is a language that enables users to access and manipulate data in a database.
4) A SELECT is a part of DML involving information retrieval only.
5) A popular data manipulation language is SQL.
6) Tables are the basic building blocks of a database.
7) There are 3 types of Relationships in a table.
Short Answer Questions:
1. What is the file extension for databases created using OpenOffice.Org Base?
Ans. The extension is .odb
2. List any three file formats that can be managed using OpenOffice.Org Base?
Ans. Three file formats that can be managed using OpenOffice.Org Base.
1. .odb
2. .odf
3. .odt
3. How many types of relationships can be created in Base? Explain each of them.
ONE to ONE : In this relationship, both the tables must have primary key columns.
Example: In the given tables EMP and DEPT, EMP_ID in EMP table and DEPT_ID in
DEPT table are the primary keys.(page No-137 ,fig-33)
ONE to MANY or MANY TO ONE : In this relationship, one of the table must have
primary key column.It signifies that one column of primary key table is associated with all
the columns of associated table.
Example: In the given tables Emp and DEPT ,EMP-ID in EMP table is primary key(page
138,figure 34)
MANY to MANY: In this relationship, no table has the primary key column. It signifies that
all the Columns of primary key table are associated with all the columns of associated table.
Example: IN the given tables EMP and DEPT, there is no primary key (page no-138,fig-35)
8
4. What do you mean by Sorting? In how many ways it can be done?
Ans. Sorting means arranging elements in particular sequence. It can be done in two ways.
1. Increasing order
2. Decreasing Order
some RDBMS provides Graphical user interface to create queries ,but some RDBMS do not
,so that SQL or Structured Query Language (sequel) is used.
Database languages are also known as query languages or data query language.[ A query is
to collect specific information from the pool of data. A query helps us to join information
from different tables and filter that information
OR
Queries are commands that are used to define the data structure and also to manipulate the
data in the database.]
SQL- is the database language by the use of which we can perform certain operations on the
existing database and also we can use this language to create a database. SQL uses certain
commands like Create, Drop, Insert, etc. to carry out the required tasks.
There are two types of languages:-
1. DDL (Data Definition Language)
2. DML (Data Manipulation Language)
9
Common DDL Statements or commands are:-
1. Create: - Used to create database or tables.
2. Alter: - Used to modify/change structure of table.
3. Drop: - Used to delete database objects.
10
SESSION- 4: RETRIEVE DATA USING QUERY
session-4
Fill in the blanks:
1. A Form helps the user to systematically store information in the database.
2. A form enables users to view, enter, and change data direc in database objects such as tables.
3. SELECT statement retrieves zero or more rows from one or more database tables or database views.
4. By default, data is arranged in ascending order using ORDER BY clause.
5. UPDATE statement is used for modifying records in a database.
6. DELETE statement is used to remove one or more records in a Database.
Ans:- Where clause of the Select statement helps to display specific data.
Ans :-Where clause helps to retrieve specific row from the table and
11
SESSION- 5: CREATE FORMS AND REPORTS USING WIZARD
1. To create a form you need to select the form option available under Database
section.
2. A query helps to collect specific information from the pool data in the database.
3. Report is used to display the summary of data.
4. Forms are the interfaces with which user the interacts.
5. Data from multiple tables can be stored in a database.
A form provides an interface that allows users Reports are used to present data from tables or
to enter, change and view the data in a database queries in a format that can be printed.
table. Forms are made up of elements, such as
textboxes, labels