Primeiros passos com SQL

Seu primeiro SELECT no Kotomarket

6 min
O que você vai aprender
  • escrever e executar sua primeira consulta no formato SELECT * FROM products LIMIT 5
  • controlar o tamanho do resultado mudando o número de linhas no LIMIT
  • explicar por que o SELECT é seguro: ele só lê os dados e não altera nada no banco

The single most important query

QUERY unfolds the archive console in front of you — an amber window in the darkness of the bay. Behind it the "Kotomarket" database sits in silence: buyers, products, orders and behavioral events, frozen since 2024. The hint at the end of the was clear: start with SELECT.

Most work with SQL really does begin with one simple act: read the data. That’s what the SELECT command is for — a question the database answers with data: "show me what you’ve got."

Let’s start with the storefront and peek into the products table. The query below asks: "return every column (*) from the products table, but no more than 5 rows." Here LIMIT n is the limiter: it tells the database to return at most n rows (looking ahead — we’ll dig into it properly, together with sorting, in Chapter 2). Hit Run, and the first rows of the storefront, asleep for 160 years, will come alive on the holopanel. Then change 5 to 10 — and you’ll see right away how to control how much the result returns.

QUERY: Go ahead, hit it. SELECT only reads — you can’t spoil the archive with a read query. I’ve tested that. Many times over.

Uma tabela holográfica de produtos ganha vida sobre o console do arquivo após o primeiro SELECT
O primeiro SELECT desperta a vitrine: cinco linhas de products emergem da escuridão no holopainel.
Os 5 primeiros produtos da vitrine do Kotomarket, após 160 anos de silêncio:
Check yourself
Para que serve a palavra-chave SELECT?