SQL is not as scary as it's painted. 5 commands to start your service 📝

An apprentice faints at the sight of code. They think it's black magic. But in reality, this language is as simple as a tsar's decree. The main thing is to know 5 commands to command data.

1️⃣ SELECT - show me everything

SELECT * FROM kazna

The command says:
"Show everything that lies in the treasury". The asterisk (*) means "everything without distinction". Dangerous if the treasury is large - the computer might ponder for a long time.

2️⃣ WHERE - show what I want right now

SELECT * FROM kazna
WHERE gold > 1000

Don't drag everything. Say clearly: "Give me only those records where gold is more than a thousand". Filter is your best friend.

3️⃣ LIMIT - take a small handful

SELECT * FROM kazna
LIMIT 5

To avoid waiting forever, take only the first 5 rows. Take a look at what's there and understand the structure.

4️⃣ AND / OR - bind conditions

SELECT * FROM kazna
WHERE city = 'Moskva' AND gold > 5000

Looking for Moscow treasury, and rich at that? Bind conditions. AND - when you need "both this and that". OR - when "either this or that".

5️⃣ ORDER BY - line up by height

SELECT * FROM krestyane
ORDER BY age DESC

Build a list. DESC - means from old to young (descending). Without this, chaos in the rows.

The main thing - don't be afraid to make mistakes 💪
SQL is not magic, it's a craft. Write, run, look at errors (they burn red for a reason)

Share this cheat sheet with a comrade, so as not to forget in the hour of need.

Which command did you learn first? Write in the comments👇