Index: S.No. Particulars No
Index: S.No. Particulars No
1
1. Introduction to DBMS
Database is a collection of related data and data is a collection of facts and figures
that can be processed to produce information. Mostly data represents recordable
facts. Data aids in producing information, which is based on facts. For example, if
we have data about marks obtained by all students, we can then conclude about
toppers andaverage marks
.
A database management system stores data in such a way that it becomes easier to
retrieve, manipulate,and produce information. DBMS stands for Database
Management System. We can break it like this DBMS = Database + Management
System. Database is a collection of data and Management System is a set of
programs to store and retrieve those data. Based on this we can define DBMS like
this: DBMS is a
collection of inter-related data and set of programs to store & access those data in
an easy and effective manner.
Characteristics :
Traditionally, data was organized in file formats. DBMS was a new concept then, and all the
research was done to make it overcome the deficiencies in traditional style of data management.
A modern DBMS has the following characteristics −
2
Real-world entity − A modern DBMS is more realistic and uses real-world entities to
design its architecture. It uses the behavior and attributes too
Relation-based tables − DBMS allows entities and relations among them to form tables.
0Isolation of data and application − A database system is entirely different than its data.
A database is an active entity, whereas data is said to be passive, on which the database
works and organizes. DBMS also stores metadata, which is data about data, to ease its
own process.
Less redundancy − DBMS follows the rules of normalization, which splits a relation
when any of its attributes is having redundancy in values. Consistency − Consistency is
a state where every relation in a database remains consistent.
Query Language − DBMS is equipped with query language, which makes it more
efficient to retrieve and manipulate data
ACID Properties − DBMS follows the concepts of Atomicity,Consistency, Isolation,
and Durability (normally shortened as ACID).
Multiuser and Concurrent Access − DBMS supports multi-user environment and allows
them to access and manipulate data in parallel.
Multiple views − DBMS offers multiple views for different users. This feature enables
the users to have a concentrate view of the database according to their requirements.
Security − Features like multiple views offer security to some extent where users are
unable to access data of other users and departments. DBMS offers methods to impose
constraints
Users of DBMS :
A typical DBMS has users with different rights and permissions who use it for different purposes.
Some users retrieve data and some back it up. The users of a DBMS can be broadly categorized
as follows −
Administrators − Administrators maintain the DBMS and are responsible for
administrating the database. They are responsible to look after its usage and by whom it
should be used. They create access profiles for users and apply limitations to maintain
isolation and force security. Administrators also look after DBMS resources like system
license, required tools, and other software and hardware related maintenance.
Designers − Designers are the group of people who actually work on the designing part
of the database. They keep a close watch on what data should be kept and in what format.
They identify and design the whole set of entities, relations, constraints, and views.
End Users − End users are those who actually reap the benefits of having a DBMS. End
users can range from simple viewers who pay attention to the logs or market rates to
sophisticated users such as business analysts.
3
Architecture of DBMS :
The design of a DBMS depends on its architecture. It can be centralized or decentralized or
hierarchical. The architecture of a DBMS can be seen as either single tier or multi-tier. An n-tier
architecture divides the whole system into related but independent n modules, which can be
independently modified, altered, changed, or replaced.
In 1-tier architecture, the DBMS is the only entity where the user directly sits on the DBMS and
uses it. Any changes done here will directly be done on the DBMS itself. It does not provide
handy tools for end-users. Database designers and programmers normally prefer to use single-tier
architecture.
If the architecture of DBMS is 2-tier, then it must have an application through which the DBMS
can be accessed. Programmers use 2-tier architecture where they access the DBMS by means of
an application. Here the application tier is entirely independent of the database in terms of
operation, design, and programming.
3-tier Architecture
A 3-tier architecture separates its tiers from each other based on the complexity of the users and
how they use the data present in the database. It is the most widely used architecture to design a
DBMS.
Database (Data) Tier − At this tier, the database resides along with its query processing
languages. We also have the relations that define the data and their constraints at this level.
Application (Middle) Tier − At this tier reside the application server and the programs
that access the database. For a user, this application tier presents an abstracted view of the
database. End-users are unaware of any existence of the database beyond the application.
At the other end, the database tier is not aware of any other user beyond the application
tier. Hence, the application layer sits in the middle and acts as a mediator between the
end-user and the database.
4
User (Presentation) Tier − End-users operate on this tier and they know nothing about
any existence of the database beyond this layer. At this layer, multiple views of the
database can be provided by the application. All views are generated by applications that
reside in the application tier.
Multiple-tier database architecture is highly modifiable, as almost all its components are
independent and can be changed independently.
Applications of DBMS :
Applications where we use Database Management Systems are:
Telecom: There is a database to keeps track of the information regarding calls made,
network usage, customer details etc. Without the database systems it is hard to maintain
that huge amount of data that keeps updating every millisecond.
Industry: Where it is a manufacturing unit, warehouse or distribution centre, each one
needs a database to keep the records of ins and outs. For example distribution centre
should keep a track of the product units that supplied into the centre as well as the
products that got delivered out from the distribution centre on each day; this is where
DBMS comes into picture.
Banking System: For storing customer info, tracking day to day credit and debit
transactions, generating bank statements etc. All this work has been done with the help of
Database management systems.
Education sector: Database systems are frequently used in schools and colleges to store
and retrieve the data regarding student details, staff details, course details, exam details,
payroll data, attendance details, fees details etc. There is a hell lot amount of inter-related
data that needs to be stored and retrieved in an efficient manner.
Online shopping: You must be aware of the online shopping websites such as Amazon,
Flipkart etc. These sites store the product information, your addresses and preferences,
credit details and provide you the relevant list of products based on your query. All this
involves a Database management system.
5
Advantage of DBMS over file system :
There are several advantages of Database management system over file system. Few of them are
as follows:
Advantages of DBMS :
Normalization of data possible and therefore duplicate data is removed
Data gets stored at a centeralized place
Data is organised and ordered
Data gets secured
Various types of data analysis can be done
Reports and forms can be created
It becomes easier to update, modify or delete the data
Disadvantages of DBMS :
It is a costly process
Trained people are required to operate database
6
Views of DMBS structure :
Physical level: This is the lowest level of data abstraction. It describes how data is actually
stored in database. You can get the complex data structure details at this level.
Logical level: This is the middle level of 3-level data abstraction architecture. It describes what
data is stored in database.
View level: Highest level of data abstraction. This level describes the user interaction with
database system.
Example: Let’s say we are storing customer information in a customer table. At physical level
these records can be described as blocks of storage (bytes, gigabytes, terabytes etc.) in memory.
These details are often hidden from the programmers.
At the logical level these records can be described as fields and attributes along with their data
types, their relationship among each other can be logically implemented. The programmers
generally work at this level because they are aware of such things about database systems.
At view level, user just interact with system with the help of GUI and enter the details at the
screen, they are not aware of how the data is stored and what data is stored; such details are
hidden from them.
7
2. Introduction to MS-Access
Microsoft Access is a type of database software that is used to store information for reporting,
referencing and analysis. With Microsoft Access, you can analyze large amounts of data faster and
more efficiently than with Excel or other types of spreadsheets.
Microsoft Access is a database management system (DBMS) from Microsoft that combines the
relational Microsoft Jet Database Engine with a graphical user interface and software-development
tools. It is a member of the Microsoft Office suite of applications, included in the Professional and
higher editions or sold separately.
Microsoft Access stores data in its own format based on the Access Jet Database Engine. It can
also import or link directly to data stored in other applications and databases.
Software developers, data architects and power users can use Microsoft Access to develop
application software. Like other Microsoft Office applications, Access is supported by Visual
Basic for Applications (VBA), an object-based programming language that can reference a variety
of objects including DAO (Data Access Objects), ActiveX Data Objects, and many other ActiveX
components. Visual objects used in forms and reports expose their methods and properties in the
VBA programming environment, and VBA code modules may declare and call Windows
operating system operations.
Track financial data without needing a separate software program. If you have the full
Microsoft Office Suite, you may even set payment reminders.
Manage marketing and sales thanks to having all customer information in the database. Send
out flyers, emails and coupons and track how customers respond.
Track production and inventory by entering data on shipments and also knowing when it’s
time to order more of a particular product.
Run reports and analyses using the reports and charts. You can basically run a report on
anything within a matter of minutes, such as customers who are behind on payment.
8
Microsoft Access (MS Access) enables one to manage all important
information from a single database file. Within the file, one can use:
• Tables to store your data.
To view the all the possible databases, you can scroll down or you can also
use the search box.
Let us enter project in the search box and press Enter. You will see the
database templates related to project management.
9
Select the first template. You will see more information related to this
template.
10
After selecting a template related to your requirements, enter a name in
the File name field and you can also specify another location for your file if
you want.
Now, press the Create option. Access will download that database template
and open a new blank database as shown in the following screenshot.
11
Now, click the Navigation pane on the left side and you will see all the other
objects that come with this database.
Click the Projects Navigation and select the Object Type in the menu.
You will now see all the objects types — tables, queries, etc.
12
Create Blank Database
Sometimes database requirements can be so specific that using and
modifying the existing templates requires more work than just creating a
database from scratch. In such case, we make use of blank database.
13
Step 2 − Select Blank desktop database. Enter the name and click the Create
button.
Step 3 − Access will create a new blank database and will open up the table
which is also completely blank.
14
3. Introduction to Oracle
Oracle tutorial provides basic and advanced concepts of Oracle. Our Oracle tutorial is designed
for beginners and professionals. Oracle is a relational database management system. It is widely
used in enterprise applications. Our Oracle tutorial includes all topics of Oracle database such as
insert record, update record, delete record, select record, create table, drop table etc.
History of Oracle
Oracle was originally developed by Lawrence Ellison (Larry Ellision) and his two friends and
former co-worker in 1977. Oracle DB runs on the most major platforms like Windows, UNIX,
Linux and Mac OS.
o Standard Edition: It provides the base functionality for users that do not require Enterprise
Edition's robust package.
o Express Edition (XE): It is the lightweight, free and limited Windows and Linux edition.
15
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,);
SELECT Syntax
SELECT column1, column2, ...
FROM table_name;
Here, column1, column2, ... are the field names of the table you want to select data from.
16
4. SQL – DML, DDL
SQL is Structured Query Language, it is a standard language for database management.
Types of SQL Statements
DDL
DDL is short name of Data Definition Language, which deals with database schemas and
descriptions, of how the data should reside in the database.
CREATE – to create database and its objects like (table, index, views, store procedure, function
and triggers)
ALTER – alters the structure of the existing database
DROP – delete objects from the database
TRUNCATE – remove all records from a table, including all spaces allocated for the records are
removed
COMMENT – add comments to the data dictionary
RENAME – rename an object
DML
DML is short name of Data Manipulation Language which deals with data manipulation, and
includes most common SQL statements such SELECT, INSERT, UPDATE, DELETE etc,
and it is used to store, modify, retrieve, delete and update data in database.
17
UPDATE – updates existing data within a table
DELETE – Delete all records from a database table
MERGE – UPSERT operation (insert or update)
CALL – call a PL/SQL or Java subprogram
EXPLAIN PLAN – interpretation of the data access path
LOCK TABLE – concurrency Control
DCL
DCL is short name of Data Control Language which includes commands such as GRANT,
and mostly concerned with rights, permissions and other controls of the database system.
DML statement are affect on table. So that is the basic operations we perform in a table.
DDL is Data Definition Language : Specification notation for defining the database schema.
It works on Schema level.
DDL commands are:
create,drop,alter,rename,truncate
For example:
DML is Data Manipulation Language .It is used for accessing and manipulating the data.
DML commands are:
select,insert,delete,update,call
For example : select account_number from account;
18
5. CREATING A TABLE IN MS-ACCESS
Let us try and create the first table that will store the basic contact
information concerning the employees as shown in the following table −
EmployeelD AutoNumber
Let us now have short text as the data type for all these fields and open a
blank database in Access.
19
This is where we left things off. We created the database and then Access automatically
opened up this table-one-datasheet view for a table.
Let us now go to the Field tab and you will see that it is also automatically created. The ID
which is an AutoNumber field acts as our unique identifier and is the primary key for this
table.
20
Click on the Name & Caption option in the Ribbon and you will see the
following dialog box.
We now have our employee ID field with the caption Employee ID. This is
automatically set to auto number so we don't really need to change the data
type.
21
Choose Short Text as the field. When you choose short text, Access will then highlight that
field name automatically and all you have to do is type the field name .
Type FirstName as the field name. Similarly, add all the required fields as
shown in the following screenshot.
22
Once all the fields are added, click the Save icon.
You will now see the Save As dialog box, where you can enter a table name for the table.
23
6. Create a table and Save using SQL
24
7. Select records from table SQL
SELECT * FROM Table_name ;
25
8. Select records from table with a condition
The WHERE clause is used to filter records.
The WHERE clause is used to extract only those records that fulfill a specified
Condition.
WHERE Syntax
SELECT column1, column2, ...
FROM table_name
WHERE condition;
Let’s take a table ‘customers’ :
We get ,
26
To add a column in a table, use the following syntax:
You can add a field to a table by typing into the last column in Datasheet view. Access
automatically assigns a data type based on the data that you enter. Access may also
27
automatically set the Format property for a new field. For example, if you enter 10:50
am, Access sets the data type to Date/Time and the Formatproperty to Medium Time.
You can add a field to the end of a table by picking from a list:
Open the table, and in the last column, click Click to Add.
If you want to add a new field in the middle of table, you can choose a field from
the Fields tab on the ribbon. The Fields tab displays predefined fields that you can add
to a table while working in Datasheet view.
UPDATE Syntax
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
28
1 Rajesh Ludhiana Punjab
Thus, we get
In the example above there is only ONE PRIMARY KEY (PK_Person). However,
the VALUE of the primary key is made up of TWO COLUMNS (ID + LastName)
29
12. Demonstrate SQL JOINS
30
31
INNER JOIN :
32
LEFT OUTER JOIN :
RIGHT JOIN :
33
FULL OUTER JOIN :
34
12. Relational Algebra and Calculus
Relational database systems are expected to be equipped with a query language that can assist its
users to query the database instances. There are two kinds of query languages − relational
algebra and relational calculus.
Relational Algebra
Relational algebra is a procedural query language, which takes instances of relations as input and
yields instances of relations as output. It uses operators to perform queries. An operator can be
either unary or binary. They accept relations as their input and yield relations as their output.
Relational algebra is performed recursively on a relation and intermediate results are also
considered relations.
Select
Project
Union
Set different
Cartesian product
Rename
Relational Calculus
In contrast to Relational Algebra, Relational Calculus is a non-procedural query language, that is,
it tells what to do but never explains how to do it.
35
13. Display unique records from a table
Shows only unique records from the table
36
14. Display all records from a table in ascending order
of rollno
SELECT * from STU ORDER by ROLLNO;
37
16. Display all the employees who joined AFTER year
2000
SELECT * FROM EMPLOYEES WHERE EMPDOJ > ‘1-JAN-2000’ ;
38
click on that button to launch the Form Wizard.
On this first screen in the wizard, you can select fields that you want to display on your form,
and you can choose from fields from more than one table or a query.
Let us assume we want to simply have a quick form that we are going to use for data entry
for our employee information.
From Tables/Queries drop-down list, select tblEmployees table. Click on the double arrow
to move all the fields at once.
Let us just leave it with that one table, and click Next.
39
The following screen in the Form Wizard will ask for the layout that we would like for our
form. We have columnar, tabular, datasheet and justifiedlayouts. We will choose the
columnar layout here and then click Next.
In the following screen, we need to give a title for our form. Let us call it frmEmployees.
Once you have given your form a title, you can open the form to see what that form looks
like, or you can begin entering information into your table. Or you can choose the option to
modify the form's design. Let us choose the first option to open the form to view or enter
information and click Finish.
40
Now, take a look at the following screenshot. This is what your form looks
like. This is a single item form, meaning one record is displayed at a time and
further down you can see the navigation buttons, which is telling us that this
is displaying the record 1 of 9. If you click on that button then, it will move
to the next record.
If you want to jump to the very last record in that form or that table, you can
use the button right beside that right arrow, the arrow with a line after it,
that's the last record button. If you want to add new employee information,
go to the end of this records and then after 9 records you will see a blank
form where you can begin entering out the new employee's information.
41
42
18. Create a report in MsAccess to display data in a
table
We will now take a simple example to understand the process of creating a very simple
report. For this, we need to go to the Create tab.
. Now click on the Report button, which will generate a report based on that query .
43
You will see that the report is open in Layout view. This provides a quick way to adjust the
size or width of any of your fields that you see on the report. Let us now adjust the column
widths to make everything fit in a better way.
44
This was a very quick way to create a very simple report.
You have the detail section, which is where all of your data lives for the most part.
Let us now change the Title of the report and give it another name.
45
Click on the save icon to save your report.
Enter a name for your report and click Ok. If you want to view what this
report will actually look like, in Print Preview, you can go back to the View
button and click on Print Preview to see what this report would look like when
printed either on paper or as a PDF.
46
47
48
49