Hiya guys, been a while since my last post about MySQL. Let’s just refresh a bit, okay, so the last post is all about the introduction of what MySQL really is and to speed things up let’s just start creating a new database, tables, put some problems and solve them of course. Check my last post if you want to find out what’s happening here. Okay! Let’s have some fun.
First of all you need to install XAMPP. For short, a XAMPP is a door you need to open to interact with your database. To be honest i can’t really explain more than that, hehee. Please by all means hit that wikipedia to find out more. They also provide the installation guide and of course it is FREE people!
Once its done, you might want to find your XAMPP and click on it. A new window will be shown and click start buttons with the modules of Apache and MySQL. Once you clicked the button it will change to ‘stop’ that means the port is ready to use. Just like this
Good and you are ready to go!
Next, open your most favorite browser in your PC, in my case google chrome and insert this http://localhost:8080/phpmyadmin in the URL to access the phpMyAdmin to create your first database.
There you go, you can see the link up above inserted to access the phpMyAdmin and of course you can start working here. On the left, you can see a few databases that i made earlier. Notice the ‘New’, click that to create a new database. You can either do that or click the SQL on the right side (between status and basis data) and when a blank space is showed just simply type
CREATE DATABASE desired_database_name
For example : create database tut1. And you are ready to go! A new database is created and let’s create the table, cus our database seems lonely.
Again you can either choose the simple way, click this and that to create something or choose the complex way which is typing the query. My personal recommendation is choose the complex way. Because life is not easy, that’s a fact and sometimes you might not be able to just ‘click’ on things to make them. But you need to know the query, like inner join, left and right join, and many more (Let’s talk about them some other time).
With that being said, i’m gonna start explaining about the query now, just the query. Because clicking things were very easy and i’m sure you’ll find no problem.
CREATE TABLE tbl_student (
student_id INT (15) NOT NULL,
name VARCHAR (20) NOT NULL,
gender CHAR (1) NOT NULL,
address VARCHAR (20),
PRIMARY KEY (student_id)
Hit send and you are good to go, a table called ‘tbl_student’ is created. It has some data types like INT, VARCHAR, CHAR, DATE and their values inside the brackets. Click here to find out more.
And one more thing, i may have typed every query syntax in uppercase but i don’t think that mysql is case-sensitive. I did that so it is easier for us to difference between the data types or the query to non query statements. And for the format of the query, you don’t have to typed exactly the same as i did. You can’t make them all in one line, horizontally but i’m sure you don’t want to do that if you have a lot of query. Because it will be hard for you to read it.
Okay then! I think we are done, folks!
For the next post i think we are going to talk more about mysql, going deeper to talk about WHERE, SELECT, FROM, and INSERT INTO. Stay tune and have a great weekend!