Learn MySQL Basics in 10 Minutes
This article redirects Learn MySQL Basics in 10 Minutes and shows you how to do (CRUD Operations) MySQL insert, update, delete, and search in MySql. MySQL is a very famous database in software engineers and begins who is learning Information Technology. you may remember for the very first time in your college also taught about MySQL DB. That’s why it is more important to understand the basics of MySQL.
MySQL is an open-source database server as well as it is a relational database management system (RDBMS). The meaning of the SQL is Structured Query Language. This database has been used in many Java and PHP based applications as its database since a more efficient and fast database and free license. Please follow the steps given below.
Firstly, connect to MySQL server using the terminal
mysql -u root -p
Secondly, Show available databases
SHOW DATABASES;
Thirdly, Create a new database called “learnmysql”
CREATE DATABASE learnmysql;
Then, Use a new database which recently created
USE learnmysql;
Create a new table called “myusers”
CREATE TABLE myusers(
id INT(4) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(100),
regdate TIMESTAMP);
Insert data to the “myusers” table
INSERT INTO learnmysql.myusers (firstname,lastname,email,regdate) VALUES ('Rajitha','Bhanuka','user1@gmail.com','2019-08-06');
INSERT INTO learnmysql.myusers (firstname,lastname,email,regdate) VALUES ('Prabath','Madushan','user2@gmail.com','2019-08-07');
INSERT INTO learnmysql.myusers (firstname,lastname,email,regdate) VALUES ('Sajith','Chiran','user3@gmail.com','2019-08-05');
Show inserted data
SELECT * FROM learnmysql.myusers;
Update selected user data
UPDATE learnmysql.myusers SET firstname='Nicolos', lastname='John', email= 'user4@gmail.com' WHERE id =1;
Finally, Delete selected user data
DELETE FROM learnmysql.myusers WHERE id =2;
As a result of practicing this article you were able to Learn MySQL Basics within 10 Minutes, you can get a better understanding of referring my next article, create a simple java application with a MySQL database.
To download MySQL server please visit – MySQL Community Downloads