Eli5: What is database in computer

36 views

What are the terms, sql database and how its used everyday.

In: 1

You can think of a database as a whole bunch of spreadsheets that all reference each other. You might have a business selling cookies, and so you have one spreadsheet with all your customers with each customer assigned a number, and then another spreadsheet of cookie orders that reference back to that customer on the first sheet. And then you can write programs that use all that information tell you how many bakers you need to schedule based on how many orders need to be filled, and how much of each ingredient you’ll need.

A database is at the most basic level – a spreadsheet.
Each column is called a “table” and each row in that column is a line of data.
A database is just a large collection of data that is sorted into categories by a program that manages the finding and changing/adding/removing of data in those columns.

For example – we can database your name.
We can have column A – First column B – middle Column C – last.

Now that we have that data and it’s separated into categories- we can use it in other programs or scenarios.

Databases are special applications to store, organize and update data. Even Google spreadsheet can be used as a database by another application to store and organize it’s data.

Usually, databases are not meant to be used by end-users like me and you like Google spreadsheet or an Excel file. They are built to be used by other websites and software applications.

SQL, NoSQL, PostGres, MongoDB, etc… what’s all that? So, just like softwares can be built in a number of programming languages (Javascript, C++, Go, Python, etc), databases too have their own special languages. Also, each db will have it’s on special way of storing and managing data.

SQL = “Structured Query Language”

It’s actually a general term that amounts to “a specific way to ask a computer to return or change information”.

When most people say “SQL” they mean T-SQL, specifically the Microsoft version, but there are a number of variants.

There are several types of database that organize data differently, but when saying anything about SQL were generally talking about relational databases. So what’s a relational database?

I’m going to assume we’re all familiar with the general concepts of spreadsheets, here.

So…imagine you’ve got a spreadsheet named “redditors”. They’ve got some specific identifier from the system, like “userID” that’s garanteed to be unique. They may also have some extra data like “display name” and email. So that’s a spreadsheet named redditors with those three columns.

Now you want to do something like see what subs they’re subscribed to, right?

So you create another spreadsheet to track subs called “subreddits”. It has some basics like subredditID, SubredditName and ‘subredditSubTitle’. That’s another spreadsheet with a few columns

So now you can create a list that matches up users to the subs they’re subscribed to. It’ll only need UserId and subredditID and you’ll populate it with the same IDs from the other sheets.

So…that’s a relational database. Different sheets holding different data, but related by sharing IDs between them.

SQL then is just the specific vocabulary and grammar around asking that computer to look at the Subscriptions list you made, look up the userName from the redditors sheet that goes with the ID stored there and the subreddit name stored in the subreddit sheet with the same subredditID. Those are called joins but it gets a bit beyond the “what is a database” question.

If you want to play with SQL a bit, express licenses are free and you can learn the language on w3schools

There is many different types of database. Generally, if you’ve used Excel or Google Sheets, a database could be seen as something like that.

SQL is a language we use to get stuff (and insert stuff) into the database. For instance, imagine you wanted to get a drink at a bar. You would ask the bartender for that drink in English (or the language expected to be spoke about at that bar [this can vary too for databases]). Imagine you replace English with SQL and the bar for a database and the drink is a piece of data.

An SQL query (query = request/action) looks something like this:

SELECT beer FROM stock_room WHERE beer = “Bud Light”

(I haven’t used SQL in my day-to-day job in awhile but the syntax (meaning how the query is structured) is similar to this).

You could replace this query for many things. Such as you go onto Amazon and in the search bar you type in ‘Lights’, that could look like this (but of course much much more advanced) in their code connected to that search bar:

SELECT product_title FROM products WHERE product_title like ‘%Lights%’

This would query their database table ‘products’ (using the FROM portion above) and select ONLY the product_title from the results, ONLY IF the product contains the word ‘Lights’

Database is a general term for a store of structured data that can be interacted with by an application. The database is usually a standalone data store, with a separate application (DataBase Management System) that handles the details of data storage, organisation, retrieval etc.

A relational database is a type of database which stores data in separate tables, each with columns and rows. An individual table isn’t much different to a spreadsheet, where each row represents an item of data, and each column represents an attribute of that data point. A relational DB is like multiple spreadsheets that reference that relate the data points together.

Structured Query Language is a type of computer language designed for interacting with relational databases and their data. It is a standard that databases from different vendors can choose to adopt or not.

A SQL Database is a type of database software that implements SQL as the prime mechanism for querying its data.

Many software applications today deal in some way with large amounts of data, so they may use a database to handle storage and retrieval of the data.