A relational database is based on the relational model and uses a collection of tables to represent both data and the relationships among those data.
A database management system is a collection of interrelated data and set of programs to access those data.
MYSQL is a relational database management system where SQL stands for Structured Query Language.It is an open source software.
Following are the commands which we use to store and access information from it.
- DDL(Data Definition Language) COMMANDS
- create
- alter
- drop
- truncate
- rename
- DML(Data Manipulation Language) COMMANDS
- select
- insert
- update
- delete
- call
- Example
mysql> create database school;
Query OK, 1 row affected (0.63 sec)
mysql> use school;
Database changed
mysql> create table student(sid int not null,sname varchar(20) not null);
Query OK, 0 rows affected (0.55 sec)
mysql> desc student;
2 rows in set (0.13 sec)
Query OK, 1 row affected (0.63 sec)
mysql> use school;
Database changed
mysql> create table student(sid int not null,sname varchar(20) not null);
Query OK, 0 rows affected (0.55 sec)
mysql> desc student;
| Describe the table |
2 rows in set (0.13 sec)
| Adding one more column to student table using alter command |
| inserting records in the table and view or retrieve the data using the select command. Notice here we have same details in the table.To avoid this we should use primary key. |
| Using truncate remove the records and then alter the definition of your table using modify command, to allow unique values in it. |
| update the details of student using update command. |
| Rename the table to students using rename command. |
| Delete a record from table using delete command |
Following video explains the same