Intro
SQL is a declarative language, you tell the system what do you want, and system figures it out how to give it to you
SQL (Structured Query Language) is a special-purpose programming language designed for managing information in a relational database management system (RDBMS). The word relational here is key; it specifies that the database management system is organized in such a way that there are clear relations defined between different sets of data. SQL operates through simple, declarative statements. This keeps data accurate and secure, and helps maintain the integrity of databases, regardless of size.
Typically, you need to extract, transform, and load data into your RDBMS before you're able to manage it using SQL,
SQL Queries Syntax Order
SELECT... FROM... WHERE... GROUP BY... HAVING... ORDER BY... LIMIT...
SQL Queries Execution Order - FJWGHSOL
https://jvns.ca/blog/2019/10/03/sql-queries-don-t-start-with-select
How to describe tables
City
Field | Type |
---|---|
ID | NUMBER |
NAME | VARCHAR2(17) |
COUNTRYCODE | VARCHAR2(3) |
DISTRICT | VARCHAR2(20) |
POPULATION | NUMBER |
Critique of SQL
SQL's shortcomings can be grouped into these categories:
- lack of proper orthogonality - SQL is hard to compose
- lack of compactness - SQL is a large language
- lack of consistency - SQL is inconsistent in syntax and semantics
- poor system cohesion - SQL does not integrate well enough with application languages and protocols
SQL Naming Conventions
https://launchbylunch.com/posts/2014/Feb/16/sql-naming-conventions
References
SQL Games
- https://mystery.knightlab.com
- https://selectstarsql.com
- Oops!
- https://www.hackerrank.com/domains/sql
- https://www.w3schools.com/sql/trysql.asp?filename=trysql_asc
- https://www.w3schools.com/mysql/trymysql.asp?filename=trysql_select_where_and_or
- https://use-the-index-luke.com/3-minute-test/mysql
- Terraria
- GitHub - WebDevSimplified/Learn-SQL: Exercises for beginners to learn SQL
- SQuizL - Guess the SQL Statement
Others
- DBA
- SQL Concepts From A to Z
- https://dev.to/helenanders26/sql-201-10-ways-to-tweak-slow-running-queries-3pkb
- https://sql-steps.wizardzines.com
- https://hakibenita.com/sql-dos-and-donts
- http://bytepawn.com/how-i-write-sql-code.html#how-i-write-sql-code
- https://www.codecademy.com/courses/learn-sql/lessons/manipulation/exercises/sql
- https://www.codecademy.com/articles/what-is-rdbms-sql
- https://www.codecademy.com/articles/sql-commands?r=master
- SQL 50 - Study Plan - LeetCode
- SQL Tutor Beta | Data Elixir Pro
- Database Design for Google Calendar: a tutorial | Database Design Book