Files
Baradb/docs/bg/baraql.md
T
dimgigov e1bae0c7a0 Add comprehensive documentation with i18n support (EN/BG)
- Add docs/ folder with English (en/) and Bulgarian (bg/) documentation
- Create index.md with language switching and links
- English docs: installation, quickstart, architecture, baraql, storage,
  schema, lsm, btree, vector, graph, fts, columnar, transactions,
  distributed, protocol, udf, api-binary, api-http, api-websocket
- Bulgarian docs: installation, quickstart, architecture, baraql,
  schema, lsm, btree, vector, graph, fts, transactions, distributed
- Update README license to BSD 3-Clause
- Add LICENSE file with BSD 3-Clause text
2026-05-06 16:51:14 +03:00

1.7 KiB

BaraQL - Референция на Езика

BaraQL е SQL-съвместим език за заявки с разширения за графи, вектори и документи.

Основни Заявки

SELECT

SELECT name, age FROM users WHERE age > 18 ORDER BY name LIMIT 10;

INSERT

INSERT users { name := 'Alice', age := 30 };

UPDATE

UPDATE users SET age = 31 WHERE name = 'Alice';

DELETE

DELETE FROM users WHERE name = 'Bob';

Агрегати и Групиране

SELECT department, count(*), avg(salary)
FROM employees
GROUP BY department
HAVING count(*) > 5;

JOINs

-- INNER JOIN
SELECT u.name, o.total
FROM users u
INNER JOIN orders o ON u.id = o.user_id;

-- LEFT JOIN
SELECT u.name, o.total
FROM users u
LEFT JOIN orders o ON u.id = o.user_id;

CTEs (Common Table Expressions)

WITH active_users AS (
  SELECT * FROM users WHERE active = true
)
SELECT * FROM active_users;

CASE Изрази

SELECT name,
  CASE
    WHEN age < 18 THEN 'minor'
    WHEN age < 65 THEN 'adult'
    ELSE 'senior'
  END AS category
FROM users;

Схема

CREATE TYPE Person {
  name: str,
  age: int32
};

Векторно Търсене

INSERT articles {
  title := 'Nim Programming',
  embedding := [0.1, 0.2, 0.3, ...]
};

SELECT title FROM articles
ORDER BY cosine_distance(embedding, [0.1, 0.2, 0.3, ...])
LIMIT 5;

Графични Шаблони

MATCH (p:Person)-[:KNOWS]->(friend:Person)
WHERE p.name = 'Alice'
RETURN friend.name;

Пълнотекстово Търсене

SELECT * FROM articles
WHERE MATCH(title, body) AGAINST('database programming');