
MySQL Notes
文章平均质量分 67
Learning MySQL and MariaDB 学习笔记
KnightHacker2077
CSNOOB
展开
-
Data types
INTINT[(width)] [UNSIGNED] [ZEROFILL]4 bytes in storage width = number of digits displayed!= storage width unsigned = positive number zerofill: fill left with 0 until widthExample:CREATE TABLE test_bigint (id BIGINT UNSIGNED);BIGINTBIGIN.原创 2022-02-24 08:45:02 · 326 阅读 · 0 评论 -
MySQL Learning Note 005 -- Adding, deleting and updating
Add data to tablesINSERT INTO table_name VALUES(col_1, col_2, col_3, ...); // 按顺序填入所有fields,字符串要加引号, 每个field之间要加逗号,结尾要加分号Use null when the field is auto-generated override auto value by manually providing a valuef Use ignore to disregard duplic原创 2022-01-25 05:36:14 · 916 阅读 · 0 评论 -
MySQL Learning Note 004 -- Querying
Select rows based on column valueSELECT * FROM table_name WHERE col_name = value; // select all rows that satisfies SELECT col_1, col_2 FROM table_name WHERE col_name = value; // only specified columns from rows that satisfiesExample matching cond原创 2022-01-21 06:46:08 · 405 阅读 · 0 评论 -
MySql Learning Notes 003 -- DB Design
Collect requirement from stakeholders Identify entities Identify primary keys Identify relationship N:M -- create intermediate relations (to convertN:M into two 1:N relationships) 1:N -- "1" side entity PK as foreign key in N...原创 2022-01-18 23:53:00 · 506 阅读 · 0 评论 -
SQL: Join
将其他表(可以是多张表)中的列添加过来Inner Join原创 2021-10-21 23:54:02 · 102 阅读 · 0 评论 -
Concurrency problems in DBMS Transactions
(i). Temporary Update Problem(ii). Incorrect Summary Problem(iii). Lost Update Problem(iv). Unrepeatable Read Problem(v). Phantom Read Problem Temporary Update Problem:数据corrupt,没来得及重输or返回原状,另一个transaction就读了这个corrupted value.The corrupted val.原创 2021-10-08 00:32:46 · 250 阅读 · 0 评论 -
MySQL Learning Note 002 -- Relational DB
Relation= table Tuple= row Attribute= column Domain= allowed set of values for an attribute SuperKey:a set of one or more attributes, identify uniquely a tuple in the relation CandidateKey:The smallest subset among all superKeys PrimaryKey: a...原创 2021-05-13 16:08:02 · 136 阅读 · 0 评论 -
MySQL Learning Note 001 -- DB Basics
Login to MySQLmysql -h localhost -u root -p-h + 主机地址;-u + Username;-p + PasswordCreate Usersgrant all on *.* to 'username'@'hostname'; // grant 所有权限 on 所有 databaseList all Users select user from mysql.user;List all DBshow databas.原创 2020-12-19 23:48:05 · 244 阅读 · 1 评论