> For the complete documentation index, see [llms.txt](https://harshityadav95.gitbook.io/system-design/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://harshityadav95.gitbook.io/system-design/sql.md).

# SQL

### Traditional way of storing the data before the database

* Sequential  Master update in a single file and sort timely for the faster update, done on magnetic data drives
* Random access data  , stored in the disk drives and faster access but sorting not feasible  , disks were easy to do update and read
* &#x20;Structured query language came as a standard to read and interact with database from different vendors
* SQL is most powerful non procedural language &#x20;

### Structure of Database Sheet

![](https://2828957172-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFPF_rDo5w1k3YcJibC%2Fsync%2Fe3738ceb704a8a50b66f8e022892e25438ecc0a7.png?generation=1624104627036583\&alt=media)

### [Creating the SQL database standard](https://d3c33hcgiwev3.cloudfront.net/0gemkpv2TNOHppKb9tzTtw_707f99e7a6394059bf9d7db120115550_2014-08-SQL-Fong-Copyright-IEEE.pdf?Expires=1624147200\&Signature=VMDF0t-ZMQcGneJayVwF~YjvI2jTrHLbaNnU4WPDW8FzPrhxD-~qNPgtpEbz0t6cBhwVMrkHBGF~xQ4zs4P1eQEo7iznxsecmJAYHyuhoCoSETumVbdd6V-kLNomCFKXMOWT2Bw4NYeWYgYzaIR-5WsNvgbesstOxQpDc1H4m8s_\&Key-Pair-Id=APKAJLTNE6QMUY6HBC5A)

### Interactive Learning &#x20;

* &#x20;<https://sqlbolt.com/>&#x20;

### Reference&#x20;

* &#x20;[Anomaly Detection using simple SQL](https://hakibenita.com/sql-anomaly-detection)
* [Speeding up SQL queries by orders of magnitude using UNION](https://www.foxhound.systems/blog/sql-performance-with-union/)
* [**Practical SQL for Data Analysis**](https://hakibenita.com/sql-for-data-analysis)
* [HOW TO INTERPRET POSTGRESQL EXPLAIN ANALYZE OUTPUT](https://www.cybertec-postgresql.com/en/how-to-interpret-postgresql-explain-analyze-output/)
* [Thinking in Events: From Databases to Distributed Collaboration Software](https://martin.kleppmann.com/2021/07/02/debs-keynote-thinking-in-events.html)
* [Recursion in SQL](https://medium.com/swlh/recursion-in-sql-explained-graphically-679f6a0f143b)
