Computers need to store data. Typically they do so in files, but if many computers need the same data files are not practical. As such, databases were invented.
Databases store data in tables, think of them as different excel sheets. Metaphorically, each table matches an excel sheet.
Getting data out of the database
But once you have data in databases, how do you interact with them? You use a computer language called SQL. Where a single command, lets you create, read, write and update data in one or more database tables.
Each table has columns (horizontally) and rows/records (vertically). In the screenshot, the columns are user_id, name, email, country and signup_date. And you can see many records/rows in there like (101, Priya Raman, priya at gmail.com India, 2023-11-02, Premium).
You can get specific columns, by modifying the query:
SELECT name, email FROM users;
There's always a semicolon (;) at the end of a query. Selecting the columns, returns only those columns.
If you want to select a row, you add WHERE to the end of the query, like so,
SELECT name, email FROM users WHERE email = 'liam@outlook.com';
But more often, the unique ID is used,
SELECT * FROM users WHERE user_id = 104;
Besides getting data out of the database, you can of course delete, update and insert data into database tables too with SQL. You can play around with SQL, without installing.
These days SQL is used everywhere, any website you use online, any mobile app you use, SQL is running behind the scenes to work with data.


Top comments (0)