Before starting programming in SQL, seek first to understand the world around it. A world composed of databases, data, hard drives, queries.
What is a database?
A database is like a big box containing information.
Once you insert information in a database, you can easily and quickly retrieve, update or delete this information. Even if you have millions and millions of things kept inside.
In this database, you can:
- insert information when you gain a new customer, a when a new employee joins the company.
- update information when the customer changes phone number or an employee has a higher salary.
- retrieve the information when you want to call or mail an existing customer, or get information about a payment.
What is data ?
The information contained in a database is also called data.
How does a database look like ?
A database is invisible for the human eye. It is information recorded on a hard drive. Like a film or music recorded on a DVD.
A hard what?
A hard drive. A hard drive looks like a thin box made of plastic and metal. It is sitting inside a computer. Hard drives store information, like DVD or CD do.
If you look inside this box, you will see something looking like a thick CD turned upside down (you can see one on the left hand side on the picture). In case of more modern hard drives (Solid State Drives: you can see one on the right hand side of the picture), you will see a few microchips glued on a green or blue board.
Why not just keep the information in a text file?
It is more convenient and faster to search and manipulate information with a database, especially if you have a lot of data.
What is an SQL query?
A query is an order given to the database to execute an action, such as:
- retrieving data.
- inserting or updating data.
- deleting data.
You should write this order in a language that the database can understand. One of these languages is SQL. SQL stands for Structured Query Language.