sql Flashcards
format of inner join
SELECT column1, column2 FROM “table1”
INNER JOIN “table2”
ON “table1”.”column” = “table2”.”column”
WHERE condition
GROUP BY column
ORDER BY column ASC/DESC;
sql vs nosql database
- sql req FIXED predefined schema whras nosql DH predefined schema (more dynamic)
- in sql, data stored in tables w FIXED data type for each field whras for nosql, data is stored as collections of documents with NO fixed data type (X enforce constraints on data types)
- sql is ACID, nosql is flexible
when to choose sql
if ACID (atomicity, consistency, isolation, durability) compliance impt + flexibility X crucial factor
when to choose nosql
if flexibility impt (in adding/rmving data, when requirements of apps change over t)
+ horizontal scalibility (adding more comp) is a criteria (whr addition of low cost servers desired compared to replacing existing server w btr one) (or startups fast growing, need database to scale as they grow)
challenges when using NoSQL
NoSQL X enforce constraints :. more code validation needs to be implemented
higher chance of code duplication / harder to normalise data using NoSQL bc collections cannot be joined using a query :. need be more careful to avoid breaking data integrity