# OurSQL learning pages / শেখার পেজ

| Page | Location | What it does |
|---|---|---|
| Practice | Sidebar → Practice & challenges, or SQL → Help & resources | 24 problems in three sections; English/Bangla questions; real MariaDB SELECT/WITH queries |
| Visualize | Practice → Visualize, or SQL → Help & resources → Concept visualization | JOIN tables, matching diagrams and logical processing steps |

## Practice / অনুশীলন

1. Choose a problem from All, Foundations, Connections or Advanced. Everything is available for self-paced study.
2. Open **Schema & sample data** to see the four tables and visible sample rows. Read the requested column order and whether row order matters.
3. Write SQL in the editor. **Format** uses the existing OurSQL formatter; **Copy** copies the query. Ctrl/Cmd+Enter tests; Ctrl/Cmd+Shift+Enter submits.
4. **Test query** runs on the visible sample and shows your rows and the expected sample. It does not award XP.
5. **Submit answer** runs on three fresh datasets. Values, column count/order, duplicate multiplicity and requested row order must match. Equivalent aliases and exact numeric representations (such as 90 and 90.000) are accepted without floating-point conversion. A mismatch on another dataset is reported separately. Only sample rows are displayed.
6. **Hint** gives guidance. **View solution** reveals SQL and permanently marks this challenge assisted until practice reset; first completion then earns half XP.
7. **Next challenge** moves forward. Query drafts are remembered per problem in this browser. The language selector changes questions, guidance and controls between English/Bangla.

These are finite learning checks, not an anti-cheat judge or proof for every possible input. Challenges currently cover read-only queries. DDL/DML practice remains available in the main SQL workspace. Reference solutions and grading fixtures are local public source.

## Progress / অগ্রগতি

| Item | Rule |
|---|---|
| XP | 30 / 50 / 80 for a first unassisted accepted answer by section; half after viewing solution |
| Repeat submissions | Recheck your answer; no extra XP |
| Level | Starts at 1; one level every 200 XP |
| Streak | First new solve on a local calendar day; consecutive days add 1; a missed day resets it |
| Badges | First solve, 8 solves, 3-day active streak, all 24 solved |
| Today’s challenge | Calendar-day selection from the 24 problems; no extra XP or separate daily reward |
| Storage | Browser-local only; no account, synchronization or public rankings |
| Reset progress | Centered confirmation dialog; clears practice records/drafts only, leaving workspace databases intact |

## Visualization / ধারণার ছবি

- **JOINs:** choose INNER, LEFT, RIGHT, FULL OUTER or CROSS. Lines connect matching rows; dimmed nodes are omitted by the selected JOIN, and unmatched retained rows have coloured labels/results. NULL never matches NULL using `=`. Repeated matches remain. CROSS connects every pair.
- **Query execution steps:** use a step button, Previous/Next, or Play/Pause to move through FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY → LIMIT. This is logical teaching order, not MariaDB’s physical execution plan.
- Copy SQL or expand and copy the demo schema. The visualization itself uses isolated JavaScript teaching data; copying does not run SQL in your workspace.

## বাংলা ফন্ট ও ডেটা

বাংলা লেখার জন্য bundled **Noto Serif Bengali** (CSS name: **Noto Serif Bangla**) ব্যবহার করা হয়। Font-এর license `fonts/Noto-Serif-Bengali-LICENSE.txt`-এ আছে।

Practice-এর MariaDB শুধু query চালানোর সময় চালু হয় এবং `memory://` data directory ব্যবহার করে। মূল workspace-এর database খোলে না। নতুন dataset প্রতিবার তৈরি হয়; নিজের query ও শেখার অগ্রগতি শুধু এই ব্রাউজারে সেভ থাকে।

## Hosting and checks

Use HTTPS and the included COOP/COEP hosting headers (Vercel configuration included). A plain HTTP preview hostname may display the pages but cannot start the threaded database engine. Learning pages, font and documentation are cached on demand. They are not imported into workspace startup.

Run `node tests/practice.mjs` for 110 model/engine checks: 72 reference executions, 24 independently specified sample outputs and 14 grading/progress/validation checks. UI preview checked language switching, saved drafts, navigation, hints, FULL JOIN diagrams and query-stage changes. Browser engine execution could not be verified on the managed HTTP preview; the exact shipped engine passed the Node tests.


## SQL Quest game / গেম

Open **SQL Quest game** from the workspace sidebar or **SQL Quest** beside Practice/Visualize. This is the supplied Foxy adventure, with its existing map, lesson progression, hearts, XP, streak, sound/mute, language toggle, sandbox, theory, exam, certificate, backup/restore and standalone HTML download.

The game uses its own teaching SQL engine and `sqlq`/`sqlg`/`sqm` storage keys. It does not run against your MariaDB workspace and does not share XP with Practice. Its SQL feature limits differ from MariaDB. For arbitrary full SQL practice, use the workspace.

Game downloads embed fonts and licenses; Share points to the game under your hosted site. Progress backup/restore is available inside the game and does not read or reset OurSQL databases.
