What is MySQL
MySQL is a Database Management System (DBMS). Which is used to create and manage Databases. To handle Database MySQL use a Query Language called SQL (Structured Query Language). MySQL is Open Source RDBMS (Relational Database Management System).
Because MySQL is RDBMS, To store Data in a Database . it uses Tables.
Data types in MySQL
Data type represents which type of Data a particular column can hold.
In MySQL Datatype is broadly classified into three categories.
- Numeric Datatype
- String Datatype
- Date and Time
The easiest way to understand MySQL
To Store data in Table firstly we have to create Database
create database mydb;
Here mydb is our Database. after creating Database we have to open it and for this, we use the following query
use mydb;
now we are in the “mydb“ database then we will create a table
create table student ( sid int(5), sname varchar (15), clas int(2), rollno int(5) );
it will create a Table named student, and the table has 4 column name sid, sname, clas and rollno.
Now we will insert data into a table
To insert data in the table we use the following query
insert into student (sid,sname,clas,rollno) values (1,’Rahul’,12,1201);
after successfully executing the command it will store 1 record in the table.
just like that we again insert another record. we use the same query but values are different
insert into student (sid,sname,clas,rollno) values (2,’Ajay’,12,1202);
Now you understand how to insert a record in the table, every time we have to insert a record in the table we will use the insert command.
we have inserted two records in the table but we are not able to see them.
To see table or table data we use the following query
select * from student;
it will show all records of a table.
sid | sname | clas | rollno |
1 | Rahul | 12 | 1201 |
2 | Ajya | 12 | 1202 |
So what we learned from this post
1. How to create a database
2. How to create a Table.
3. How to insert data in the Table
4. How to see data from a Table.
In my next post, we will learn how to retrieve data from a table with various types
Want to learn DBMS click below
What is Database Management System