When it comes to database architecture, it basically follows three types of architectures. They are –

  • 1-Tier architecture 
  • 2-Tier architecture
  • 3-Tier architecture

1-Tier architecture – in this architecture, end users work with databases directly. Ex – MySQL command line client. For testing/tutorial purposes we can install MySQL database into our system.

2-Tier architecture – In this architecture, basically there are two types of layers(presentation layer and data layer). Here, the data layer belongs to the database.

Lets understand through real life examples. If you fill-up any form online, then your form data goes into the database. Now understand through 2-tier architecture.

Your web-browser(chrome/firefox) works as a presentation layer and database(ex. MySQL) works as a data layer. Proper example of 2-Tier architecture – ODBC, JDBC(Java Database Connectivity)

3-Tier architecture – In this architecture, basically there are three types of layers(presentation layer, application layer and data layer). This architecture is used for production purposes. If you work with MySQL in your school or college, then you will face XAMPP server and phpmyadmin. phpmyadmin is a proper example of 3-tier architecture. When we create any table and modify that table, the request goes first into the apache server and then into mysql database. After execution of the query it returns a result and displays it in phpmyadmin.

image: phpmyadmin(XAMPP server)

Basic difference between 2-Tier and 3-Tier architecture is, in 3-Tierthere is only application layer present between presentation layer and data layer.

image: 3-tier architecture

Data flow

You might think about a common thing, how the data traverses when you fill-up any online registration form for any reason, how it goes into the database?

Let’s understand this using an image below-