Database
Basic
————————————————————————————————————————————————————————————Procedure vs Function:
Function returns value
Procedure just executes commands
————————————————————————————————————————————————————————————Primary Key vs Foreign Key
Primary Key: A column or group of columns uniquely identify each record in a database table.
Foreign Key: used to link two tables together. It's a field in one table that refers to the primary key in another table.
————————————————————————————————————————————————————————————Left Join
Returns all records from the left table, and the matched records from the right table.
————————————————————————————————————————————————————————————MySQL vs NoSQL
MySQL is a relational database which supports Structured Query Language. It's table based and requires you to use predefined schema to determine the structure of your data before work with it.
NoSQL database has dynamic schema for unstructured data, and data is stored in many ways: it can be column-oriented, document-oriented, graph-based or key-value based.
In terms of scalability, SQL databases are vertically scalable, which means you can increase the load on a single server by increasing things like CPU, RAM or SSD. NoSQL databases are horizontally scalable, which means you can handle more traffic by sharding, or adding more servers in your NoSQL databases.
————————————————————————————————————————————————————————————Trigger
It's a special kind of stored procedure that automatically executes when an event occurs in the database server.
————————————————————————————————————————————————————————————Join vs Union
Join combines data into new columns. If two tables are joined together, then the data from the first table is shown in one set of column alongside the second table’s column in the same row.
Union combine data into new rows. If two tables are “unioned” together, then the data from the first table is in one set of rows, and the data from the second table in another set. The rows are in the same result.
————————————————————————————————————————————————————————————Normalization
It's a technique of organizing the data in the database. The aim is to eliminate data redundancy.This includes creating tables and establishing relationships between those tables according to rules designed both to protect the data and to make the database more flexible by eliminating redundancy and inconsistent dependency.
————————————————————————————————————————————————————————————Sharding vs Partition
It's a type of database partitioning that separates very large databases into smaller, faster, more easily managed parts called data shards.
个人感觉,Sharding 往往用于分布式数据库(分表、备份等),而 Partition 往往指代单机的数据库(分表、备份等)。
————————————————————————————————————————————————————————————
Select vs Project
Select: pick rows
Project: pick columns
Last updated