Vous êtes sur la page 1sur 8

Structured Query Language (SQL) fourth-generation (4GL) programming

char(n). Fixed length character string, with user-specified length n. maximum character is 2000
varchar(n). Variable length character strings, with user-specified maximum length n. max character is
4000
int. Integer (a finite subset of the integers that is machine-dependent).
float(n). Floating point number, with user-specified precision of at least n digits.
CODING
SELECT * FROM publishers
SELECT *
from publishers
where state = CA
INSERT INTO publishers
VALUES (0010, pragmatics, 4 4th Ln, chicago, il)
CREATE DATABASE database_name
USE database_name
CREATE TABLE authors
(auth_id int(9) not null,
auth_name char(40) not null)
SELECT auth_name, auth_city
FROM publishers
DELETE from authors
WHERE auth_name=John Smith
UPDATE authors
SET auth_name=hello
ALTER TABLE Tname
ADD birth_date datetime null
ALTER TABLE authors
DROP birth_date
DROP DATABASE authors
SELECT AVG(apple) AS new // MIN MAX
FROM table
WHERE apple = a
OR apple = b
Relational Algebra

selection

< condition > < tablename >


Example: course = CM Students
Projection
< column list > < tablename >
Example: stud#, name Students
stud#, name ( course = CM Students)
Binary Operations
Cartesian Product
R X S
Set Operations
Union

Intersection

Difference
Normalization

Database normalization is the process of removing redundant data from your tables in to improve
storage efficiency, data integrity, and scalability.

1st Normal Form

has a primary key


no repeating groups
values in each column of a table are atomic (No multi-value attributes allowed).

2nd Normal Form

All requirements for 1st NF must be met.


Redundant data across multiple rows of a table must be moved to a separate table.
The resulting tables must be related to each other by use of foreign key.
3rd Normal Form

All requirements for 2nd NF must be met.


Eliminate fields that do not depend on the primary key;
That is, any field that is dependent not only on the primary key but also on another field must be
moved to another table.

We have seen how Database Normalization can decrease redundancy(), increase efficiency and
reduce anomalies
ER Entity Relationship Diagram

ER diagram is widely used in database design


Introduction to database

A database is a collection of information that is organized so that it can easily be accessed,


managed, and updated.
information After processing (such as formatting and printing), output data can again be
perceived as information.or an a organized data is called information
Data are known facts that can be recorded and that have implicit meaning
Definition of data: Information in raw or unorganized form
What is database application:-Banking, Airlines, Universities, Sales
Filed based system
Improved Data Sharing
Security, Backup/Recovery, Concurrency
Improved Data Quality
Advantages of the database approach:- Minimal Data Redundancy
RECORD BASE HNR
1.Hierarchical data model.

2. Network data model.

3. Relational data model.


Components of DBMS
Hardware
Software
Data
Procedures
People
4G language

SQL
FoxPro
Relational Data Structure

Degree bil attribute


Primary Key
o Candidate key selected to identify records uniquely within table.
o Avoid redundant data
o Relationship between table
Alternate Keys
o Candidate keys that are not selected to be primary key.
Foreign Key
o Column, or set of columns, within one table that matches candidate key of some
(possibly same) table.

Vous aimerez peut-être aussi