Documentos de Académico
Documentos de Profesional
Documentos de Cultura
WEAKNESS
DATA REDUNDANCY
same data stored in
multiple file waste of
resources
ISOLATED DATA
data
stored in separate file
difficult to share and
update
3
Database Approach
What is a database?
Collection of data
organized so
you can access,
retrieve, and
use it
Database software
also called Database
Management System
(DBMS)
Database software
allows you to
Create
database
Add,
change,
and delete
data
Sort
and
retrieve
data
Create
forms
and
reports
5
Database
Advantages of the database
Sharing Data
Increased Productivity
Database definition
Storage structure and access method definition
Database modification
Granting user authority to access the database
Specifying constraints
Monitoring performance and responding to changes
in requirements
Backup & Recovery
Relational Database
Relational database
attributes/ fields
Primary key
records/ tuples
Relational database
10
Relational database
SQL statement
SELECT Jersey, PlayerNm, BirthPlace From Player WHERE SponsorID = 1
Jersey
PlayerNm
BirthPlace
Shanil
Selangor
Aaron
Perak
11
12
Drop
13
Update
Delete
DDL--Table Creation
General syntax for CREATE TABLE
CREATE TABLE employees (
Employee_id INTEGER(8),
Last_name
VARCHAR(25),
First_name
VARCHAR(25),
Reports_to
INTEGER );
OR
CREATE TABLE customer (
First_Name
char(50),
Last_Name
char(50),
Address
char(50) default 'Unknown',
City
char(50) default 'Mumbai',
Country
char(25),
Birth_Date
date );
15
Alter Table Statement: Once a table is created in the database, there are
many occasions where one may wish to change the structure of the table.
Typical cases include the following:
- Add a column
- Drop a column
- Change a column name
- Change the data type for a column
ALTER table customer add Gender char(1) ;
ALTER table customer drop Gender ;
ALTER table customer change Address1 Address2 char(50) ;
ALTER table customer modify Address2 char(30) ;
16
17
DML--Insert Statement
Adds data to a table
18
DML--Delete Statement
19
DML--Update Statement
20
21
When you want to select all columns in the table , use * in the
SELECT Clause
SELECT *
FROM PRODUCT
WHERE PRICE < 275;
AVG: the arithmetic mean (average) for the specified column (attribute)
22
23