This document provides an overview of databases and SQL. It begins with a brief introduction to databases, including what they are, database management systems (DBMS), and relational database management systems (RDBMS). The document then discusses the history and evolution of databases. It introduces MySQL as a popular open source RDBMS and compares its features. The document also covers database concepts and design, including requirement analysis, logical design, and the database life cycle. Finally, it provides an introduction to SQL and an example of using the CREATE TABLE syntax.
3. Recap
We meet a customer
We understand his needs
We make a plan
We scratch the design
Database Design
TRIVUz Academy
www.trivuzacademy.com
www.trivuzacademy.com
4. We are going to learn
Brief introduction on Database
Array
Array Functions
Global Array
Loop
for, do…while, for each
Functions
Database Design
TRIVUz Academy
www.trivuzacademy.com
6. DATABASE
Brief Introduction
What is Database?
Often abbreviated DB. A collection of information
organized in such a way that a computer program can
quickly select desired pieces of data. You can think of a
database as an electronic filing system.
TRIVUz Academy
7. DATABASE
Brief Introduction
What is Database?
Traditional databases are organized by fields, records,
and files.
A field is a single piece of information;
a record is one complete set of fields;
and a file is a collection of records.
TRIVUz Academy
8. DATABASE
Brief Introduction
What is Database?
For example, a telephone book is analogous to a file. It
contains a list of records, each of which consists of
three fields: name, address, and telephone number.
TRIVUz Academy
9. DATABASE
Brief Introduction
What is Database?
For example, a telephone book is analogous to a file. It
contains a list of records, each of which consists of
three fields: name, address, and telephone number.
Name Address Phone Number
Mr. Khan Banani, Dhaka 02-01020304
Farah Zebin Uttara, Dhaka 02-23344556
Robindranath Uttara, Dhaka 02-44543212
TRIVUz Academy
10. DATABASE
Brief Introduction
DBMS
To access information from a database, you need a
database management system (DBMS). This is a
collection of programs that enables you to enter,
organize, and select data in a database.
TRIVUz Academy
11. DATABASE
Brief Introduction
RDBMS
A relational database management system (RDBMS) is
a database management system (DBMS) that is based
on the relational model as introduced by E. F. Codd.
Most popular databases currently in use are based on
the relational database model.
TRIVUz Academy
12. DATABASE
Brief Introduction
RDBMS
A short definition of an RDBMS is: A DBMS in which data
is stored in tables and the relationships among the data
are also stored in tables. The data can be accessed or
reassembled in many different ways without having to
change the table forms.
TRIVUz Academy
13. DATABASE
Brief Introduction
RDBMS
A short definition of an RDBMS is: A DBMS in which data
is stored in tables and the relationships among the data
are also stored in tables. The data can be accessed or
reassembled in many different ways without having to
change the table forms.
TRIVUz Academy
14. DATABASE
Brief Introduction
History
The database concept
The database concept has evolved since the 1960s to
ease increasing difficulties in designing, building, and
maintaining complex information systems (typically with
many concurrent end-users, and with a diverse large
amount of data). It has evolved together with
database management systems which enable the
effective handling of databases.
TRIVUz Academy
15. DATABASE
Brief Introduction
History
Evolution of database and DBMS technology
The introduction of the term database coincided with
the availability of direct-access storage (disks and
drums) from the mid-1960s onwards. The term
represented a contrast with the tape-based systems of
the past, allowing shared interactive use rather than
daily batch processing.
TRIVUz Academy
16. DATABASE
Brief Introduction
History
Evolution of database and DBMS technology
In the earliest database systems, efficiency was
perhaps the primary concern, but it was already
recognized that there were other important objectives.
One of the key aims was to make the data
independent of the logic of application programs, so
that the same data could be made available to
different applications.
TRIVUz Academy
17. DATABASE
Brief Introduction
History
Evolution of database and DBMS technology
The first generation of database systems were
navigational, applications typically accessed data by
following pointers from one record to another. The two
main data models at this time were the hierarchical
model, epitomized by IBM's IMS system, and the
Codasyl model (Network model), implemented in a
number of products such as IDMS.
TRIVUz Academy
18. DATABASE
Brief Introduction
History
Evolution of database and DBMS technology
The Relational model, first proposed in 1970 by Edgar F.
Codd, departed from this tradition by insisting that
applications should search for data by content, rather
than by following links.
TRIVUz Academy
19. DATABASE
Brief Introduction
History
Evolution of database and DBMS technology
Relational systems placed heavy demands on
processing resources, and it was not until the mid 1980s
that computing hardware became powerful enough to
allow them to be widely deployed. By the early 1990s,
however, relational systems were dominant for all large-
scale data processing applications, and they remain
dominant today (2011) except in niche areas.
TRIVUz Academy
20. DATABASE
Brief Introduction
History
Evolution of database and DBMS technology
The dominant database language is the standard SQL
for the Relational model, which has influenced
database languages also for other data models.
TRIVUz Academy
21. DATABASE
Quick Look
SQL ???
What is SQL?
SQL, or Structured Query Language, is a specialized type of programming language
developed to work with relational databases such as MySQL, Oracle, Microsoft SQL
Server, PostgreSQL, Informix, and others.
The SQL standard is defined by ANSI, the American National Standards Institute in their
ISO/IEC 9075:1992 document. (The standard is commonly referred to as ANSI SQL-92.)
Every relational database applies its own version of the SQL standard; many enhance
that standard. Standardizing the programming language allows the devel- oper to
address the database in much the same way from platform to platform — and every
major platform has such products written for it. Table 1-2 compares some popular
relational-database products as illustrative examples.
TRIVUz Academy
22. DATABASE
Brief Introduction
History
Ancient to modern
http://math.hws.edu/vaughn/cpsc/343/2003/history.ht
ml
TRIVUz Academy
23. DATABASE
Brief Introduction
History
General-purpose DBMS
A DBMS has evolved into a complex software system
and its development typically requires thousands of
person-years of development effort. Some general-
purpose DBMSs, like Oracle, Microsoft SQL server, and
IBM DB2, have been in on-going development and
enhancement for thirty years or more.
TRIVUz Academy
24. DATABASE
Brief Introduction
History
Types of people involved
Three types of people are involved with a general-purpose DBMS:
1. DBMS developers - These are the people that design and build the DBMS
product, and the only ones who touch its code. They are typically the
employees of a DBMS vendor (e.g., Oracle, IBM, Microsoft, Sybase), or, in the
case of Open source DBMSs (e.g., MySQL), volunteers or people supported by
interested companies and organizations. They are typically skilled systems
programmers. DBMS development is a complicated task, and some of the
popular DBMSs have been under development and enhancement (also to
follow progress in technology) for decades.
TRIVUz Academy
25. DATABASE
Brief Introduction
History
Types of people involved
2. Application developers and Database administrators - These are the people
that design and build a database-based application that uses the DBMS. The
latter group members design the needed database and maintain it. The first
group members write the needed application programs which the application
comprises. Both are well familiar with the DBMS product and use its user
interfaces (as well as usually other tools) for their work. Sometimes the
application itself is packaged and sold as a separate product, which may
include the DBMS inside (see Embedded database; subject to proper DBMS
licensing), or sold separately as an add-on to the DBMS.
TRIVUz Academy
26. DATABASE
Brief Introduction
History
Types of people involved
3. Application's end-users :
(e.g., accountants, insurance people, medical doctors, etc.) –
These people know the application and its end-user interfaces, but need not
know nor understand the underlying DBMS. Thus, though they are the intended
and main beneficiaries of a DBMS, they are only indirectly involved with it.
TRIVUz Academy
27. DATABASE
Brief Introduction
Advantages
The speed, accuracy, reporting and thoroughness of
electronic databases make them critical to today’s
24/7 high-speed exchange of information.
TRIVUz Academy
28. DATABASE
Brief Introduction
Advantages
Speed: Format means quick storage and retrieval of
information. Users and applications have a quick
means for asynchronous reads and writes of data.
TRIVUz Academy
29. DATABASE
Brief Introduction
Advantages
Accuracy: Given careful data input, databases provide
accurate and consistent results based on their data.
TRIVUz Academy
30. DATABASE
Brief Introduction
Advantages
Reporting: Information can be gathered, quantified,
and custom-analyzed with greater flexibility.
TRIVUz Academy
31. DATABASE
Brief Introduction
Advantages
Thoroughness: Databases can store and report results
as complete and detailed as their holdings — at
electronic speed.
TRIVUz Academy
32. DATABASE
Brief Introduction
Advantages
Thoroughness: Databases can store and report results
as complete and detailed as their holdings — at
electronic speed.
TRIVUz Academy
33. DATABASE
Choose RDBMS
Existing RDBMS
TRIVUz Academy
34. DATABASE
Introducing MySQL
What is MySQL?
MySQL is the worlds most popular open source RDBMS.
TRIVUz Academy
35. DATABASE
Introducing MySQL
Why MySQL?
MySQL is the worlds most popular open source RDBMS.
MySQL is used from many large scale web sites including
Google and NASA, and is a very strong competitor to even
the likes of Microsoft SQL Server and Oracle.
MySQL is incredibly fast, provides support for full text
searches, and is widely supported.
TRIVUz Academy
36. DATABASE
Introducing MySQL
Comparison of SQL Implementations
TRIVUz Academy
37. DATABASE
Introducing MySQL
MySQL Enterprise-Level Database Features
TRIVUz Academy
38. DATABASE
Introducing MySQL
MySQL Enterprise-Level Database Features
TRIVUz Academy
39. DATABASE
Introducing MySQL
What MySQL Does Bes
Web applications: Web applications typically feature many reads and few writes.
MySQL is fast and can meet the demands of Internet speed. In my experience, MySQL
has proven time and again that it outperforms other RDBMS products in Web
applications.
Enterprise-level applications: MySQL offers support directly through the parent
company, MySQL AB. MySQL’s feature set includes just about every- thing that an
enterprise-level application would need. Refer back to Table 1-4 for more details.
Open-source support: MySQL AB is responsive to requests for features as well. MySQL is
open-source; everyone is welcome to download and extend the code to meet his or
her needs.
TRIVUz Academy
40. DATABASE
Introducing MySQL
What MySQL Does Bes
Low overhead: MySQL runs comfortably for many applications on an Intel Pentium-
class computer with 32 MB of RAM or less. I wouldn’t recommend running an
enterprise-level MySQL implementation on such a system, but consider the utter futility
of trying to run a Web application on Internet Information Server with Microsoft SQL
Server that runs under Windows 2000 on a Pentium-class computer with 32 MB of RAM.
Available large table size: MySQL tables can grow large, though they do sometimes
encounter file-size limitations of the host operating system. Some architectures,
however, can accommodate up to 8 terabytes (TB) per table using MySQL.
Stability: All software is in development. Some features in MySQL are newer than
others, making them possibly less stable than others. Table 1-6 shows some of the
features within MySQL and their stability level.
TRIVUz Academy
41. DATABASE
Database Concepts & Design
What is data?
What is database?
Why use a Database?
How are database used?
TRIVUz Academy
42. DATABASE
Database Concepts & Design
Database Design
Database design is the process of determining and
organizing the information to track. Many iterations of a
database design occur as you try to achieve an
efficient design and maximize your use of resources.
TRIVUz Academy
43. DATABASE
Database Concepts & Design
The Database Life Cycle
• Requirements analysis
• Logical design of the database
• Physical design of the database
• Implementation and subsequent modification of the
database
TRIVUz Academy
44. DATABASE
Database Design
Requirement Analysis
Gather information on the business process and items
Analysis and Document them properly
TRIVUz Academy
45. DATABASE
Database Design
Logical Design
Entities and attributes
At a basic level of a data model are entities — objects that you
are interested in as part of the data model you are creating.
Example – Marksheet
Entities have identifying qualities — attributes. For example, the
Marksheet entity has such attributes as StudentID, Subject and
Marks.
TRIVUz Academy
46. DATABASE
Database Design
Logical Design
Entities
Marksheet
Attributes
StudentID, Subject, Marks
TRIVUz Academy
47. DATABASE
Database Design
Example
Entities
Marksheet
Attributes
StudentID, Subject, Marks
Table: marksheet
Student ID Subject Marks
1001 Math 78
1003 Math 85
1005 Math 34
TRIVUz Academy
48. DATABASE
Database Design
Okay, we designed our database. We got all our
Entity & attributes.
What now?
TRIVUz Academy
49. DATABASE
Database Design
Next…
We have to create our physical
database.
TRIVUz Academy
51. DATABASE
SQL Introduction
What is SQL?
SQL, or Structured Query Language, is a specialized
type of programming language developed to work
with relational databases such as MySQL, Oracle,
Microsoft SQL Server, PostgreSQL, Informix, and others.
TRIVUz Academy
52. DATABASE
SQL Introduction
What is SQL?
The SQL standard is defined by ANSI, the American National
Standards Institute in their ISO/IEC 9075:1992 document. (The
standard is commonly referred to as ANSI SQL-92.) Every relational
database applies its own version of the SQL standard; many
enhance that standard. Standardizing the programming language
allows the devel- oper to address the database in much the same
way from platform to platform — and every major platform has
such products written for it. Table 1-2 compares some popular
relational-database products as illustrative examples.
TRIVUz Academy
53. DATABASE
SQL Example
Creating our Tables
Syntax
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] <tablename>
[(<create_statement>,...)] [table_options] [select_statement]
TRIVUz Academy
54. DATABASE
SQL Example
Creating our Tables
Code
CREATE TABLE marksheet (
marks_id int(11) NOT NULL PRIMARY KEY,
student_id int(11),
subject varchar(255),
marks varchar(255)
);
TRIVUz Academy
55. Thank You
MS Alam TRIVUz
Founder,
TRIVUz Academy
trivuz@gmail.com