Sitemap
Press enter or click to view image in full size

Basics of SQL>> Beginner Friendly

3 min readNov 17, 2023

--

(db = database)

— — — — — — <<ANSI: American National Standards Institute> >— — — — — — -

— — — — — —- -<ANSI SQL standards are used to build SQL db> — — — — — — — -

INTRO>>

1) Full form: Structured Query Language><birth year: 1970>

2) life’s purpose: Programming(Query) Language for relational databases>

<relational database: tabular format data storage (columns&rows)>

3) Statements or Queries: use to Store, Update, Remove, Search, Retrieve data> from where? => <database>

4) RDBMS: Relational database management systems use SQL> for what? <ofc, store & manage data>

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — -

1) SQL table >> made up of rows&columns

>> create relationship b/w multiple db tables-> why? <to optimize data storage space>

2) SQL statements or SQL Queries

3) Stored Procedures: Collection of one or more SQL queries, used to improve efficiency or performance> of what? <db>

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

SQL working>>

< server machine processes queries & returns results>>

Get @mtya’s stories in your inbox

Join Medium for free to get updates from this writer.

— — — — — — — — — — — — -COMPONENTS — — — — — — — — — — — — — — — -

1) Parser: tokenize or replace some words in queries with special symbols,

verifies that queries conform to SQL rules (semantics),

validates that the user has authorization to manipulate data.

2) Relational Engine: Query Processor, writes some plan for writing, updating, or retrieving data in byte code(an intermediate level representation of queries)

Relational db uses this plan written in byte code -> for searches and modifications in db.

3) Storage Engine: Database Engine, processes the byte code and runs the query, reads and stores data in files on some sort of physical disk storage, and returns the result to the requesting application.

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

SQL commands categorize:

1) DDL: Data Definition Language ~> SQL commands used to design db str.

2) DQL: Data Query Language ~> SQL commands to retrieve data from DB

3) DML: Data Manipulation Lang ~>Write new data or modify existing data

4) DCL: Data Control Language ~> Manage db access (db admin uses it)

5) TCL: Transaction Control Language ~> Used by Relational Engine to make db changes(automatically)

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

# SQL injections: cyberattack which involves tricking db with queries(ofc, SQL queries)

# MySQL(open src): RDBMS (Relational database management system)

# To think → difference b/w SQL & MySQL

# checkout a fun way to learn ~> https://sql-island.informatik.uni-kl.de/

# follow for more

--

--

@mtya
@mtya

Written by @mtya

CS grad. Interested in Human Psychology. Loves to be different no matter the cost.