UKK RPL 2024 Website Galeri Photo Membuat Database menggunakan MariaDB xampp

Raeni Official
13 Jan 202413:12

Summary

TLDRThis video tutorial demonstrates how to create and manage a relational database system using MariaDB. The presenter walks through the process of creating a new database named 'galery', setting up multiple tables such as 'user', 'foto', 'album', and 'like_photo', and establishing foreign key relationships between them. Key SQL commands like 'CREATE', 'INSERT', and 'SELECT' are explained in detail. The tutorial also covers how to manipulate data and visualize the relational structure using a database designer. This comprehensive guide is aimed at users looking to understand database creation and management using MariaDB.

Takeaways

  • 😀 The tutorial walks through creating a photo gallery database using MariaDB.
  • 😀 To start, navigate to the MariaDB console by using commands like 'cd MySQL', 'cd bin', and 'mysql -u root'.
  • 😀 The first step in database creation is to execute 'CREATE DATABASE gallery;' to initialize the gallery database.
  • 😀 The 'USE gallery;' command is then used to select and activate the gallery database for further operations.
  • 😀 A 'user' table is created with columns like user_id, username, password, email, and full_name, where 'user_id' is the primary key.
  • 😀 The 'photo' table is created with columns like photo_id, title, description, upload_date, location, and album_id, linking 'user_id' as a foreign key.
  • 😀 A third table, 'album', is created with an album_id as the primary key, and it is related to the 'user' table by 'user_id'.
  • 😀 The tutorial demonstrates adding foreign key relationships between tables using 'REFERENCES' and 'ALTER TABLE' commands to link 'photo' to 'album'.
  • 😀 The 'like_photo' table is introduced, linking users to photos they like, with columns such as 'like_id', 'photo_id', 'user_id', and 'like_date'.
  • 😀 Data is inserted into the tables using the 'INSERT INTO' SQL command, with specific values for each field, and verified through 'SELECT * FROM user;' to display the added data.

Q & A

  • What is the primary purpose of the tutorial in the provided script?

    -The primary purpose of the tutorial is to guide users in creating a photo gallery database using MariaDB, covering the entire process from database creation to inserting data and establishing relationships between tables.

  • Which database management system is used in the tutorial?

    -The tutorial uses MariaDB, which is a fork of MySQL and offers a similar structure and functionality for database management.

  • What is the first SQL command used in the tutorial?

    -The first SQL command used is `CREATE DATABASE gallery;` which creates the database named 'gallery' in MariaDB.

  • How does the script switch to the created database?

    -After creating the database, the script uses the `USE gallery;` command to switch to the 'gallery' database and make it the active database for further operations.

  • What is the structure of the 'user' table in the tutorial?

    -The 'user' table includes attributes such as `user_id` (integer, primary key), `username` (varchar), `password` (varchar), `email` (varchar), and `full_name` (varchar).

  • Why are foreign keys used in the 'photo' table?

    -Foreign keys in the 'photo' table are used to establish relationships with other tables, specifically linking `user_id` to the 'user' table and `album_id` to the 'album' table, ensuring data integrity and referential constraints.

  • What is the purpose of the `ALTER TABLE` command in the script?

    -The `ALTER TABLE` command is used to modify an existing table's structure. In the script, it's used to add a foreign key constraint to the 'photo' table, linking `album_id` to the 'album' table.

  • How are the tables related in the database schema?

    -The tables are related using foreign key constraints. For example, `user_id` in the 'photo' and 'album' tables references the 'user' table, while `album_id` in the 'photo' table references the 'album' table.

  • What does the `INSERT INTO` command do in this tutorial?

    -The `INSERT INTO` command is used to add new rows of data into the tables. For example, it inserts user information into the 'user' table, such as `user_id`, `username`, `password`, `email`, and `full_name`.

  • What is the purpose of the `SELECT` command shown in the tutorial?

    -The `SELECT` command is used to retrieve and display data from the tables. In the tutorial, it's used to view the data inserted into the 'user' table, confirming that the data was added successfully.

Outlines

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Mindmap

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Keywords

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Highlights

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now

Transcripts

plate

This section is available to paid users only. Please upgrade to access this part.

Upgrade Now
Rate This

5.0 / 5 (0 votes)

Related Tags
MariaDBSQL TutorialDatabase CreationRelational DatabaseTable RelationshipsData InsertionDatabase DesignPhoto GalleryMySQL AlternativeTech TutorialWeb Development