Day 27: My Java Learning Journey ??
Today, I started learning about Java JDBC (Java Database Connectivity) and its role in database integration. ?????
Before diving into JDBC, I explored MySQL and practiced key MySQL queries such as:
CREATE DATABASE
DROP DATABASE
CREATE TABLE
DROP TABLE
SELECT
INSERT INTO
Understanding these foundational database concepts has set the stage for effectively using JDBC to connect Java applications with databases. ??
What is MySQL?
Why Use MySQL
MySQL is a popular choice for managing relational databases for several reasons:
Applications of MySQL
MySQL has used in various applications across a wide range of industries and domains, because of to its versatility, reliability, and performance. Here are some common applications of MySQL:
Difference Between MySQL and SQL
I will walk you through some of the most commonly used MySQL queries:-
show you how to set up XAMPP, a popular local server environment, to run MySQL on your machine.
Setting Up XAMPP to Run MySQL
Step 1: Download XAMPP
To download XAMPP, follow these steps:
Step 2: Install XAMPP
Step 3: Start the XAMPP Server
I Am Using XAMPP Server to Run MySQL
Once XAMPP is running, you can use MySQL to create databases, tables, and manage data on your local server.
Now, let's go over some fundamental MySQL queries.
1. CREATE DATABASE
领英推荐
CREATE DATABASE database_name;
For example, to create a database named school, you would write:
CREATE DATABASE school;
2. DROP DATABASE
DROP DATABASE database_name;
For instance, if you want to remove the school database, you would run:
DROP DATABASE school;
3. CREATE TABLE
CREATE TABLE students (
student_id INT AUTO_INCREMENT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
birth_date DATE
);
4. DROP TABLE
DROP TABLE table_name;
For example, to drop the students table:
DROP TABLE students;
5. SELECT
SELECT column1, column2 FROM table_name;
For example, to get all student names from the students table:
SELECT first_name, last_name FROM students;
You can also use SELECT * to retrieve all columns from the table:
SELECT * FROM students;
6. INSERT INTO
INSERT INTO table_name (column1, column2, column3)
VALUES (value1, value2, value3);
For example, if you want to add a new student record to the students table, you could use:
INSERT INTO students (first_name, last_name, birth_date)
VALUES ('John', 'Doe', '2000-01-15');
My Learning Journey
I have learned these essential MySQL queries to create and manage databases and tables, as well as how to insert and retrieve data. These foundational skills have enabled me to create simple databases and effectively manipulate the data stored within them.
Next, I am excited to take my learning a step further by diving into JDBC (Java Database Connectivity). JDBC is a Java API that enables Java applications to interact with databases, including MySQL. With JDBC, I will be able to connect Java applications to MySQL, run SQL queries, and retrieve data directly from my Java programs.
?? On a mission to teach 1 million students | Developer & Mentor | 5,500+ Students ??| JavaScript | React JS | Redux | Python | Java | Springboot | MySQL | Self-Learner | Problem Solver
1 个月Well Done ??