0% found this document useful (0 votes)
5 views29 pages

Unit V

The document provides an overview of databases, specifically focusing on Relational Database Management Systems (RDBMS) and Structured Query Language (SQL). It discusses various DBMS architectures (1-Tier, 2-Tier, and 3-Tier), their advantages and disadvantages, and introduces MySQL and phpMyAdmin as tools for managing databases. Key SQL commands and important terminologies related to relational databases are also outlined.

Uploaded by

Moni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views29 pages

Unit V

The document provides an overview of databases, specifically focusing on Relational Database Management Systems (RDBMS) and Structured Query Language (SQL). It discusses various DBMS architectures (1-Tier, 2-Tier, and 3-Tier), their advantages and disadvantages, and introduces MySQL and phpMyAdmin as tools for managing databases. Key SQL commands and important terminologies related to relational databases are also outlined.

Uploaded by

Moni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Database Access through the Web

UNIT-V
Database

A database is a collection of data that is organized, which is also called


structured data. It can be accessed or stored in a computer system. It can be
managed through a Database Management System (DBMS), a software used
to manage data. Database refers to related data in a structured form.
Relational Databases

RDBMS stands for Relational Database Management System.

All modern database management systems like SQL, MS SQL Server, IBM DB2, ORACLE, My-SQL, and Microsoft Access
are based on RDBMS.

It is called Relational Database Management System (RDBMS) because it is based on the relational model introduced by
E.F. Codd.

How it works
Data is represented in terms of tuples (rows) in RDBMS.

A relational database is the most commonly used database. It contains several tables, and each table has its
primary key.

Due to a collection of an organized set of tables, data can be accessed easily in RDBMS.
Structured Query Language (SQL)

Structured Query Language is a standard Database language that is used to create, maintain, and
retrieve the relational database.
SQL is case insensitive. But it is a recommended practice to use keywords (like SELECT, UPDATE,
CREATE, etc.) in capital letters and use user-defined things (like table name, column name, etc.) in
small letters.

We can write comments in SQL using “–” (double hyphen) at the beginning of any line. SQL is the
programming language for relational databases (explained below) like MySQL, Oracle, Sybase, SQL
Server, Postgre, etc.
Some of The Most Important SQL Commands
● SELECT - extracts data from a database
● UPDATE - updates data in a database
● DELETE - deletes data from a database
● INSERT INTO - inserts new data into a database
● CREATE DATABASE - creates a new database
● ALTER DATABASE - modifies a database
● CREATE TABLE - creates a new table
● ALTER TABLE - modifies a table
● DROP TABLE - deletes a table
● CREATE INDEX - creates an index (search key)
● DROP INDEX - deletes an index
A relational database means the data is stored as well as retrieved in the form of relations (tables). Table 1 shows
the relational database with only one relation called STUDENT which stores ROLL_NO, NAME, ADDRESS,
PHONE, and AGE of students.

STUDENT Table
Important Terminologies
These are some important terminologies that are used in terms of relation.

● Attribute:Attributes are the properties that define a relation. e.g.; ROLL_NO, NAME
etc.
● Tuple:Each row in the relation is known as tuple. The above relation contains 4
tuples, one of which is shown as:

● Degree:The number of attributes in the relation is known as degree of the


relation. The STUDENT relation defined above has degree 5.
● Cardinality:The number of tuples in a relation is known as cardinality. The
STUDENTrelation defined above has cardinality 4.
● Column:Column represents the set of values for a particular attribute. The column
ROLL_NO is extracted from relation STUDENT.
How Queries can be Categorized in Relational Database?
The queries to deal with relational database can be categories as:

● Data Definition Language:It is used to define the structure of the database. e.g; CREATE TABLE, ADD
COLUMN, DROP COLUMN and so on.

● Data Manipulation Language:It is used to manipulate data in the relations. e.g.; INSERT, DELETE,
UPDATE and so on.

● Data Query Language:It is used to extract the data from the relations. e.g.; SELECT So first we will
consider the Data Query Language. A generic query to retrieve from a relational database is:

➔ SELECT [DISTINCT] Attribute_List FROM R1,R2….RM

➔ [WHERE condition]

➔ [GROUP BY (Attributes)[HAVING condition]]

➔ [ORDER BY(Attributes)[DESC]];
Different Query Combinations
Case 1: If we want to retrieve attributes ROLL_NO and NAME of all students, the query will be:
SELECT ROLL_NO, NAME FROM STUDENT;
Case 2: If we want to retrieve ROLL_NO and NAME of the students whose ROLL_NO is greater than 2, the query will be:
SELECT ROLL_NO, NAME FROM STUDENT

WHERE ROLL_NO>2;
CASE 3: If we want to retrieve all attributes of students, we can write * in place of writing all attributes as:
SELECT * FROM STUDENT

WHERE ROLL_NO>2;
CASE 4: If we want to represent the relation in ascending order by AGE, we can
use ORDER BY clause as:
SELECT * FROM STUDENT ORDER BY AGE;
DBMS Architecture 1-level, 2-Level, 3-Level
A Database store a lot of critical information to access data quickly and securely. Hence it
is important to select the correct architecture for efficient data management. DBMS
Architecture helps users to get their requests done while connecting to the database. We
choose database architecture depending on several factors like the size of the database,
number of users, and relationships between the users

Types of DBMS Architecture


There are several types of DBMS Architecture that we use according to the usage requirements. Types of
DBMS Architecture are discussed here.

● 1-Tier Architecture
● 2-Tier Architecture
● 3-Tier Architecture
1-Tier Architecture

In 1-Tier Architecture the database is directly available to the user, the user can directly sit on the DBMS and
use it that is, the client, server, and Database are all present on the same machine.
Advantages of 1-Tier
Architecture

● Simple Architecture: 1-Tier Architecture is the most simple architecture to set


up, as only a single machine is required to maintain it.
● Cost-Effective: No additional hardware is required for implementing 1-Tier
Architecture, which makes it cost-effective.
● Easy to Implement: 1-Tier Architecture can be easily deployed, and hence it is
mostly used in small projects.
2-Tier Architecture

The 2-tier architecture is similar to a basic client-server model. The application at the client end directly communicates
with the database on the server side. APIs like ODBC and JDBC are used for this interaction. The server side is
responsible for providing query processing and transaction management functionalities. On the client side, the user
interfaces and application programs are run. The application on the client side establishes a connection with the server
side in order to communicate with the DBMS.
Advantages of 2-Tier Architecture

● Easy to Access: 2-Tier Architecture makes easy access to the database, which makes
fast retrieval.
● Scalable: We can scale the database easily, by adding clients or by upgrading hardware.
● Low Cost: 2-Tier Architecture is cheaper than 3-Tier Architecture and Multi-Tier
Architecture.
● Easy Deployment: 2-Tier Architecture is easy to deploy than 3-Tier Architecture.
● Simple: 2-Tier Architecture is easily understandable as well as simple because of only
two components.
3-Tier Architecture

In 3-Tier Architecture, there is another layer


between the client and the server. The client does
not directly communicate with the server. Instead,
it interacts with an application server which
further communicates with the database system
and then the query processing and transaction
management takes place. This intermediate layer
acts as a medium for the exchange of partially
processed data between the server and the client.
This type of architecture is used in the case of
large web applications.
Advantages of 3-Tier Architecture

● Enhanced scalability: Scalability is enhanced due to distributed deployment of application servers.


Now, individual connections need not be made between the client and server.
● Data Integrity: 3-Tier Architecture maintains Data Integrity. Since there is a middle layer between the
client and the server, data corruption can be avoided/removed.
● Security: 3-Tier Architecture Improves Security. This type of model prevents direct interaction of the
client with the server thereby reducing access to unauthorized data.

Disadvantages of 3-Tier Architecture

● More Complex: 3-Tier Architecture is more complex in comparison to 2-Tier Architecture.


Communication Points are also doubled in 3-Tier Architecture.
● Difficult to Interact: It becomes difficult for this sort of interaction to take place due to the presence of
middle layers.
What is MySQL?
● MySQL is a database system used on the web
● MySQL is a database system that runs on a server
● MySQL is ideal for both small and large applications
● MySQL is very fast, reliable, and easy to use
● MySQL uses standard SQL
● MySQL compiles on a number of platforms
● MySQL is free to download and use
● MySQL is developed, distributed, and supported by Oracle
Corporation

The data in a MySQL database are stored in tables. A table is a collection of related data, and it consists of
columns and rows.

Databases are useful for storing information categorically. A company may have a database with the
following tables:

● Employees
● Products
● Customers
● Orders
Introduction to PHP MyAdmin
● phpMyAdmin is an open-source software tool introduced on September 9, 1998, which is
written in PHP.
● Basically, it is a third-party tool to manage the tables and data inside the database.
phpMyAdmin supports various type of operations on MariaDB and MySQL.
● The main purpose of phpMyAdmin is to handle the administration of MySQL over the
web.
● It is the most popular application for MySQL database management.
● We can create, update, drop, alter, delete, import, and export MySQL database tables by
using this software.
● phpMyAdmin also supports a wide range of operation like managing databases,
relations, tables, columns, indexes, permissions, and users, etc., on MySQL and
MariaDB.
● These operations can be performed via user interface, while we still have the ability to
execute any SQL statement.
Features of phpMyAdmin
phpMyAdmin supports several features that are given below:

○ phpMyAdmin can create, alter, browse, and drop databases, views, tables, columns, and indexes.
○ It can display multiple results sets through queries and stored procedures.
○ phpMyAdmin use stored procedure and queries to display multiple results sets.
○ It supports foreign keys and InnoDB tables.
○ phpMyAdmin can track the changes done on databases, views, and tables.
○ We can also create PDF graphics of our database layout.
○ It supports mysqli, which is the improved MySQL extension.
○ phpMyAdmin can interact with 80 different languages.
○ phpMyAdmin can edit, execute, and bookmark any SQL-statements and even batch-queries.
○ By using a set of pre-defined functions, it can transform stored data into any format. For example - BLOB-
data as image or download-link.
○ It provides the facility to backup the database into different forms.
Advantage of phpMyAdmin

○ phpMyAdmin can run on any server or any OS as it has a web browser.


○ We can easily create, delete, and edit the database and can manage all elements using the graphical interface of
phpMyAdmin, which is much easier than MySQL command-line editor.
○ phpMyAdmin helps us to control the user's permission and operate several servers at the same time.
○ We can also backup our database and export the data into different formats like XML, CSV, SQL, PDF, OpenDocument
Text, Excel, Word, and Spreadsheet, etc.
○ We can execute complex SQL statements and queries, create and edit functions, triggers, and events using the graphical
interface of phpMyAdmin.
Disadvantage of phpMyAdmin
○ phpMyAdmin is a simple interface, but quite tough for a beginner to learn.
○ phpMyAdmin is difficult to install as it needs three more software tools before installation,
which is- Apache server, PHP, and MySQL.
○ We have to install all these software tools individually, whereas XAMPP already contains
them in a single package. XAMPP is the easiest way to get phpMyAdmin.
○ It has no schema visualization.
○ phpMyAdmin is a web-based software tool which runs only on the browser, so It
completely depends on browsers.
○ It does not have auto-compilation capability.
Prerequisite

○ Web server - Apache, Nginx, IIS


○ PHP
○ Database - MySQL, MariaDB
○ Web Browser

Web server - phpMyAdmin's interface is based on our web browser, we need a web server to
keep phpMyAdmin's files inside it. Apache and IIS are popular web servers. We can download
Apache web server from here http://mirrors.estointernet.in/apache//httpd/.
PHP - We also need to install PHP 5.3 or upper version to support different functionalities. It contains different
extensions to provide support for these functionalities. For example -

○ Session support -SPL (Standard PHP Library) extension


○ Uploading of ZIP files support -PHP zip extension
○ Cookie authentication - mcrypt extension
○ Open Document Spreadsheet and XML importing support -libxml extension

We can download PHP from here. https://www.php.net/downloads.php.

Database - phpMyAdmin supports databases, i.e.

○ MySQL 5.5 or latest versions


○ MariaDB 5.5 or latest versions

Download the MySQL database from here https://dev.mysql.com/downloads/file/?id=486088 or MariaDB database


from here https://mariadb.org/download/.

Web Browser - Web browser is required to access phpMyAdmin with enabled cookie and JavaScript. It can be
Chrome, Internet Explorer, etc.
END
Syllabus completed
ALL THE BEST FOR EXAMS

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy