Detri Amelia Chandra
  • HOME
  • GIS
  • HTML
  • Bootstrap
  • CSS
  • Javascript
  • Ubuntu
  • Useful Tools
    • URL Redirect Tool
    • URL Download Encryptor
No Result
View All Result
Detriamelia.com
  • HOME
  • GIS
  • HTML
  • Bootstrap
  • CSS
  • Javascript
  • Ubuntu
  • Useful Tools
    • URL Redirect Tool
    • URL Download Encryptor
No Result
View All Result
Detriamelia.com
No Result
View All Result

Database Table Relations Using Join Operations and the Classical Model

09/08/2023
in Belajar PHP, MySQL
Database Table Relations Using Join Operations and the Classical Model

Database Table Relations Using Join Operations and the Classical Model

MySQL is a highly popular relational database in today’s programming world. With features that allow for table-to-table relationships, MySQL databases have become the most widely used databases worldwide. Before delving deeper, for those of you who haven’t read the previous article, please read Web Programming and Mobile Devices – Library Part-1 as this article is related to the previous one.

To combine data between tables, a relationship between one table and another is necessary. In Database learning, this action is referred to as table relationships. This involves linking between tables. For a clearer understanding, let’s directly practice by following the steps I’ve prepared below.

Before proceeding, make sure you have followed the previous tutorial, as this time we will continue the discussion and add a new table to the same database.

Table Relationship in Database Using Join Operation and Classic Model

1. Create a new table named “member” with its fields as shown in the following image.

Users Table
Users Table Structure

2. Next, create a new table named “user” with fields according to the following image.

User Table
User Table Structure

Observe the two newly created tables. Both of these tables have fields as connectors between the two tables that I’ve prepared. The connector in the “member” table is useradd, while in the “user” table it’s id_user.

Now, let’s establish a relationship between these two tables.

3. Creating Classic Model Relationship Query

The following query is used to display member data along with the name of the Admin who inputted the data. Please execute the following query to see the results:

1
SELECT a.*, b.`nm_user` AS input_admin FROM member a, `user` b WHERE a.`useradd` = b.`id_user`

4. Creating Relationship Query Using Inner Join

With the same function as the classic query above, please execute the following query:

1
SELECT a.*, b.`nm_user` FROM member a INNER JOIN `user` b ON a.`useradd` = b.`id_user`

Both of the above operations serve the same purpose: to combine and display data from two related tables. The difference is that the classic operation is simpler but is only recommended for table relationships with a small amount of data. Using the classic model operation with large tables will be very slow. On the other hand, the join-based relationship operation is a bit more complex, but highly effective in handling large amounts of data.

Feel free to practice to experience the difference. If you have any questions about this topic, please leave a comment in the comment section below this article. Hope it’s helpful…

Tags: Belajar PHPMySQL
ShareTweetShare

Related Posts

Web and Mobile Programming – Library Part-1
Belajar PHP

Web and Mobile Programming – Library Part-1

This time we will discuss the creation of a basic web-based library application. Of course, we will thoroughly explore CRUD...

09/08/2023
Next Post
Learn Python Basics for Beginners: Easy Ways to Understand the Python Programming Language

Learn Python Basics for Beginners: Easy Ways to Understand the Python Programming Language

Introduction to Python Programming: A Beginner's Guide

Introduction to Python Programming: A Beginner's Guide

Comments 4

  1. mas ambyar (gundul) says:
    3 years ago

    terima kasih sangat bermanfaat 🙂 walau pun ga paham tetap berguna !

    Reply
  2. mas ambyar (gundul) says:
    3 years ago

    terima kasih sangat bermanfaat 🙂 walau pun ga paham tetap berguna !

    Reply
  3. Fitrah Andini says:
    2 years ago

    Sangat bermanfaat sekali…

    Reply
    • Detri Amelia Chandra says:
      2 years ago

      Terimaksh sdah berkunjung…

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recommended

PHP Switch Statement

8. PHP Switch Statement

15/01/2020
PHP Forms - Validation With Required Fields

14. PHP Forms – Validation With Required Fields

15/02/2020
PHP Syntax, Variables and PHP Echo/Print

4. PHP Syntax and PHP Variables

29/11/2019
install-apache-mysql-and-php-in-ubuntu-18-04-lts-part-2

3. How to Install Apache, MySQL and PHP in Ubuntu 18.04 LTS Part 2

11/11/2019

Instagram Feed

  • HOME
  • GIS
  • HTML
  • Bootstrap
  • CSS
  • Javascript
  • Ubuntu
  • Useful Tools
Detriamelia.Com

© 2022 Detri Amelia Chandra - IT Tips and Programming Tutorials.

No Result
View All Result
  • HOME
  • GIS
  • HTML
  • Bootstrap
  • CSS
  • Javascript
  • Ubuntu
  • Useful Tools
    • URL Redirect Tool
    • URL Download Encryptor