Database

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 9

Accessing Database

Chapter 28

Objectives
You will learn about:
Relational database concepts
Use of Structured Query Language (DDL,
DML,DCL)
java.sql. API
Javax.sql.RowSet
PreparedStatement
Transaction Processing

What is Database
Is a permanent storage of data
Is an organized collection of data
Is a collection of organized data in
tables(row,colums)
Table is a collection of related records
Records is a collection of related
fields

Database management
Systems
Provides mechanism to interact with the database to:
Store
Organise
Retrieve
Modify data for users

Currently database systems called relational


database management systems (RDMS)
(provides relations of related tables)
Examples of RDMS:
Microsoft SQL Server, Oracle, Sybase, IBM DB2,
Informix, PostreSQL, MySQL

How Access Database


A SQL (Structured Query Language) is used to:
Create, Drop and Modify Database objects/tables
using Data Definition Language (DDL)
Read, store, update and delete records in tables
using Data Manipulations Language (DML)
Grant and provoke users access to database tables
using Data Control Language (DCL)

The DDL and DCL mostly is used by Database


administrators
And DML is used by programmers to access
stored data.

How Database is Accessed

User Applications (GUI)

Application Interfaces (JDBC-ODBC) API


Database Management Systems (Database Engines)
(Drivers)

User

Database
Employee
I
D

Nam
e

surname

deptN
o

courseCod
e
descript
ion

Database
Student

Descripti
on
studN Nam surnam
o
e
e

Relational Database
Is a logical representation of data in tables
Each table has a name (tblEmployee, tblStudent,
TblCourse)
Each table is composed of rows/columns
Each row is a collection of records
Each column is a field for each record

Each table must have a primary key


Primary key is an unique value that cant be duplicated
Guarantees that each row/record is accessed by its unique
number

Rows in table are not guaranteed to be stored in a


particular order

Example of Relational
Database
Student database may consist related
tables as follows:
tblStudent (studentNo Pm)
tblSubject (FK_studentNO)
tblFees (FK_studentNO)

Relationship
(one to one)
(one to many)
(many to many)

Use (SQL) on MySQL database


Engine
DDL to create the table
DML to access

You might also like