Tu primer SELECT en Kotomarket
Qué aprenderás
- a escribir y ejecutar tu primera consulta del tipo
SELECT * FROM products LIMIT 5 - a controlar el tamaño del resultado cambiando el número de filas indicado en
LIMIT - a explicar por qué
SELECTes seguro: solo lee datos y no cambia nada en la base de datos
La consulta más importante de todas
QUERY despliega ante ti la consola del archivo: una ventana ámbar en la oscuridad del compartimento. Al otro lado, la base de datos de Kotomarket aguarda en silencio: compradores, productos, pedidos y eventos de comportamiento, congelados desde 2024. La pista al final del volcado era clara: empieza por SELECT.
Casi todo el trabajo con SQL empieza con una acción sencilla: leer datos. Para eso sirve el comando SELECT: es una pregunta a la que la base de datos responde devolviendo datos, como si dijeras «enséñame lo que tienes».
Empecemos por el escaparate y echemos un vistazo a la tabla products. La consulta de abajo pide: «devuelve todas las columnas (*) de la tabla products, pero como máximo 5 filas». Aquí LIMIT n actúa como límite: indica a la base de datos que devuelva, como mucho, n filas (nos adelantamos un poco: lo veremos en detalle, junto con la ordenación, en el Capítulo 2). Pulsa Ejecutar y las primeras filas del escaparate, dormidas durante 160 años, cobrarán vida en el holopanel. Después cambia 5 por 10 y verás al instante cómo controlar el tamaño del resultado.
QUERY: Dale sin miedo.
SELECTsolo lee: con una consulta de lectura no puedes estropear el archivo. Lo he comprobado. Muchísimas veces.

SELECT despierta el escaparate: cinco filas de products emergen de la oscuridad y aparecen en el holopanel.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.
SELECTonly reads — you can’t spoil the archive with a read query. I’ve tested that. Many times over.
| id | name | category | price | stock |
|---|---|---|---|---|
| 1 | Беспроводные наушники | Электроника | 5990.00 | 120 |
| 2 | Смарт-часы | Электроника | 8990.00 | 60 |
| 3 | Портативная колонка | Электроника | 3490.00 | 90 |
| 4 | Веб-камера HD | Электроника | 2790.00 | 45 |
| 5 | Механическая клавиатура | Электроника | 4590.00 | 70 |