You have probably had assignments where you need to store data, for example a phone book in whichever programming language you are studying. You probably have a few hundred numbers at most, and so the efficiency is not a problem but if you were storing all the phone numbers for a city for a phone book then a database is a much more appropriate way of doing it. The vast majority of databases use SQL (Structured Query Language) to access them, and despite the name it is not just for querying the database but also for creating the layout of the database tables and for inserting data.
Let’s take the example of a phonebook, you need to determine the fields present. So we would have name, phone number and address. You can also normalize a database, the idea is not to repeat data which helps when you change data, so for example women’s surname changes when they get married, so it would make sense to change it once and that it would change all the records. So we may have 3 tables.
Name / Phone / Address, the phone table would have an index into the name and address tables (so someone can have multiple numbers, but would only have 1 name). Phone numbers are unique, so we can tell the database that you can’t have multiple entries with the same phone number. The name table would need title, first name, last name, maybe a middle name and the address table would include street address, city and postcode.
More complex queries would deal with sales for a company as you may want to find which category of product has the most sales per region, which could involve functions on the data and joins between tables.
There are ORM’s that enable you to access the database as though it was stored in the native language (Django ORM, Pony, SQLAlchemy for Python), (Hibernate for Java).
If you need to use a particular database such as SQLite, MySQL, PostGres or Oracle then let us know, or even if it is one of the new No SQL databases such as MongoDB.