MySQL Introduction
MySQL is a free and very popular relational database system. A database is a place where a website or app stores its data in an organised way, like users, products, orders and blog posts. WordPress, Facebook and many other big sites use MySQL.
Database, table, row and column
MySQL keeps data in tables, which look like Excel sheets.
| id | name | city | marks |
|---|---|---|---|
| 1 | Robin | Delhi | 85 |
| 2 | Maria | Mumbai | 92 |
- A database is a collection of tables.
- A table stores one kind of data, like students.
- A column (field) is one kind of information, like name.
- A row (record) is one complete item, like one student.
What is SQL?
SQL (Structured Query Language) is the language you use to talk to the database: create tables, add data, read it, change it and delete it. MySQL is the software, and SQL is the language it understands.
SELECT name, marks FROM students WHERE marks > 80;
| Group | Meaning | Commands |
|---|---|---|
| DDL | Define the structure | CREATE, ALTER, DROP |
| DML | Change the data | INSERT, UPDATE, DELETE |
| DQL | Read the data | SELECT |
| DCL | Control access | GRANT, REVOKE |
| TCL | Control transactions | COMMIT, ROLLBACK |
How MySQL works
MySQL is a client-server system. The MySQL server stores the data. Your program (a PHP page, a Python script, phpMyAdmin or the command line) is the client: it sends an SQL command and gets the result back.
Why MySQL?
- Free and open source.
- Fast, reliable and easy to learn.
- Works with PHP, Python, Java, Node.js and almost every language.
- MariaDB is a very similar database that came from MySQL, and nearly all examples here work in both.
If you want to use MySQL from PHP, see PHP MySQL. In this series we learn SQL itself, step by step.
Summary
- MySQL is a relational database that stores data in tables.
- SQL is the language to work with it.
- Next: MySQL Installation.
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |