DEV Community

Cover image for SQL fundamentals and databases
oteri
oteri

Posted on • Originally published at linkedin.com

SQL fundamentals and databases

No company today exists without data.

From the big companies like Netflix, Google, Instagram, and so on have a repository where their data are stored in databases and it powers every app we use daily.

What is SQL?

Let's simply put it this way, structured query language (SQL) is a programming language used to talk to databases which is a declarative language using SQL statement.

A typical example of a statement is as follows:

SELECT NAME
FROM USERS
WHERE ROLE = 'MANAGER';
Enter fullscreen mode Exit fullscreen mode

Want to try out some SQL? Check out this exercise on DB Fiddle, an online SQL playground to practice.

p.s.: SQL is a standardized language meaning it has its set of rules

How to use SELECT

As previously stated, if you want to get the data from a database, the SELECT keyword is your go to.

To get the rows and columns, use the wildcard (*):

SELECT * FROM employees;
Enter fullscreen mode Exit fullscreen mode
 emp_no | birth_date |   first_name   |    last_name     | gender | hire_date  
--------+------------+----------------+------------------+--------+------------
  10001 | 1953-09-02 | Georgi         | Facello          | M      | 1986-06-26
  10002 | 1964-06-02 | Bezalel        | Simmel           | F      | 1985-11-21
  10003 | 1959-12-03 | Parto          | Bamford          | M      | 1986-08-28
  10004 | 1954-05-01 | Chirstian      | Koblick          | M      | 1986-12-01
  10005 | 1955-01-21 | Kyoichi        | Maliniak         | M      | 1989-09-12
Enter fullscreen mode Exit fullscreen mode

Get only two columns from the table, employees:

SELECT emp_no, firstname
FROM employees
LIMIT 5;
Enter fullscreen mode Exit fullscreen mode

This statement returns the list of only 5 employees from the table with the LIMIT keyword.

 emp_no |   first_name   
--------+----------------
  10001 | Georgi
  10002 | Bezalel
  10003 | Parto
  10004 | Chirstian
  10005 | Kyoichi
Enter fullscreen mode Exit fullscreen mode

What is a database?

Before databases, there were file processing systems (FPS). One disadvantage of using this system is you can't keep the data updated across multiple files.

Databases on the other hand with its pictorial representation as drums, is a collection of data, a method of accessing and manipulating that data. And to manage the database, a software or program (DBMS) is required like PostgreSQL making it a fun experience to produce statements to view the data as tables.

To discover more of the SQL fundamentals, I shared my thoughts in this post below like database models, tables and components, and the differences between OLTP vs OLAP:

'teri eyenike on LinkedIn: 🎯 Discover the language, SQL that powers databases

Is SQL still popular today? Lately, I have been revisiting and improving on my SQL knowledge which is an interesting query language to use. I will walk you…

favicon linkedin.com

Top comments (0)