1. Slow down. The more you understand, the less you have to memorize. Don’t just read. Stop and think. When the book ask you a question, don’t just skip to the answer. Imagine that someone really is asking the question.  The more deeply you force your brain to think, the better chance you have of learning and remembering.
  2. Do the exercises. Write your own notes.
  3. Read the “There are No Dumb Questions”
  4. Make this the last thing you read before bed. Or at least the last challenging thing.
  5. Drink water. Lots of it.
  6. Talk about it. Out loud.
  7. Listen to your brain.
  8. Feel something!
  9. Create something.
  10. A database is a container that holds tables and other SQL structures related to those tables.
  11. A table is the structure inside your database that contains data, organized in columns and rows.
  12. Each category becomes a column in your table. A table row contains all the information about one object in your table.
  13. The information inside the database is organized into tables.
  14. The SQL language requires all tables to be inside of databases
  15. The semicolon is there to indicate that the command has ended
  16. All of the tables in a database should be connected in some way
  17. DESC your_table_name to view your table
  18. Drop table will work whether or not there is data in your table. Once your table is deleted, it’s gone, along with any data that was in it.
  19. You can change the order of your column names, as long as the matching values for each column come in that same order
  20. If we have a column that we know is usually a specific value, we can assign it a DEFAULT value. The value that follows the DEFAULT keywords is automatically inserted into the table each time a row is added if no other value is specified. The default value has to be of the same type of value as the column.
  21. A NULL value is an undefined value. It does not equal zero or an empty value. A column with a NULL value IS NULL, but does not EQUAL NULL.
  22. Columns that are not assigned values in your insert statements are set to NULL by default
  23. The * is telling the RDBMS to give you back the values from all of the columns in your table.
  24. The varchar, char, blog, date, and time data types need single quotes. The numeric types, dec and int, do not
  25. Single quotes are special characters, handle quotes with a backslash.
  26. You can't select a null value directly, but you can select it using keywords
  27. Like, used with a wildcard, looks for part of a text string and returns any matches
  28. Percent sign %, which can stand in for any number of unknown characters
  29. Underscore, _ which stands for just one unknown character
  30. The smaller number must always be first for the BETWEEN to be interpreted the way you expect
  31. Use IN with a set of values in parentheses, when the value in the column matches one of the values in the set, the row or specified columns are returned.
  32. A table is all about relationships
  33. When it’s ATOMIC, that means that it's been broken down into the smallest pieces of data that can't or shouldn’t be divided
  34. A column with atomic data can't have several values of the same type of data in that column.
  35. A table with atomic data can't have multiple columns with the same type of data.
  36. Making your data atomic is the first step in creating a NORMAL table
  37. Normal tables won't have duplicate data, which will reduce the size of your database
  38. With less data to search through, your queries will be faster
  39. To be 1NF, a table must follow these two rules: Each row of data must contain atomic values; each row of data must have a unique identifiers, known as a primary key
  40. A primary key is a column in your table that makes each record unique. The primary key is used to uniquely identify each record, which means that the data in the primary key column can't be repeated.
  41. A primary key can't be null, if it's null, It can't be unique because other records can also be NULL
  42. The primary key must be given a value when the record is inserted
  43. The primary key must be compact
  44. The primary key values can't be changed
  45. If you change the data type to something new, you may lose data.
  46. Alter table drop column yourcolumn;
  47. Use change when you want to change both the name and the data type of a column.
  48. Use modify when you wish to change only the data type
  49. Drop  column does just that: it drops the named column from the table.
  50. Use rename to change the name of your table.
  51. You can change the order of your columns using first, last before column_name
  52. Use right() and left() to select a specified number of characters from a column.
  53. Use substring_index() to grab part of the column, or substring. This one wull find everything in front of a specific character or string.
  54. String functions do not change the data stored in your table, they simply return the stored strings as a result of your query.
  55. Select something and order the data it returns by another column from the table.
  56. By default, SQL returns your order by columns in ASCEDDING order
  57. Use the keyword DESC after your column name in order by clauses to reverse the order of your results.
  58. Sum all of them at once with group by.
  59. Count will return the number of rows in a column.
  60. Get the second position: select first_name, sum(sales) from cooie_sales group by first_name order by sum(sales) desc limit 2
  61. ORDER BY: alphabetically orders your results based on a column you specify
  62. GROUP BY: Consolidate rows based on a common column.
  63. DISTINCTL: Returns each unique value only once, with no duplicates
  64. LIMIT: Lets you specify exactly how many rows to return and which row to start with.
  65. A description of the data(the columns and tables) in your database, along with any other related objects and the way they all connect is known as a SCHEMA.
  66. The foreign key is a column in a table that references the primary key of another table.
  67. A foreign key can have a different name than the primary key it comes form
  68. The primary key used by a foreign key is also known as a parent key. The table where the primary key is from is known as a parent table.
  69. The foreign key can be used to make sure that the rows in one table have corresponding rows in another table
  70. Foreign key values can be null, even though primary key value can’t
  71. Foreign key don’t have to be unique—in fact, they often aren't .
  72. A null foreign key means that there’s no matching primary key in the parent table. But we can make sure that a foreign key contains a meaningful value, one that exists in the parent table, by using a constraint.
  73. You can use a foreign key to reference a unique value in the parent table. It doesn’t have to be the primary key of the parent table, but it must be unique.
  74. One-to-One: exactly one row of a parent table is related to one row of a child table.
  75. Many-to-many: a junction table holds a key from each table.
  76. 1NF, rule1: columns contain only atomic values; no repeating groups of data.
  77. A key made of two or more columns is known as a composite keys.
  78. A composite key is a primary key composed of multiple columns, creating a unique key
  79. Your 1NF table is also 2NF if all the columns in the table are part of the primary key or it has a single column primary key.
  80. If your table has an artificial primary key and no composite primary key, it’s in 2NF.
  81. 3NF: rule1: be in 2NF, rule2: have no transitive dependencies.
  82. SQL let’s you assign an alias for a column name so you won't get confused
  83. The cross join returns every row from one table crossed with every row from the second.
  84. An inner join combines the records from two tables using comparison operators in a condition. Columns are returned only when the joined row match the condition.
  85. Non-equijoin inner joins test for inequality
  86. Natural join inner joins identify matching column names.
  87. A subquery is a query that is wrapped within another query. It’s also called an inner query.
  88. If a subquery is used as a column expression in a select statement, it can only return one value from one column.
  89. A left outer join takes all the rows in the left table and matches them to rows in the RIGHT table. It’s useful when the left and the right table have a one-to-many relationship.
  90. In a left outer join, the table that comes after from and before the join is the LEFT table, and the table comes after join is the RIGHT table.
  91. The difference is that an outer join gives you a row whether there’s a match with the other table or not.
  92. A NULL value in the results of a left outer join means that the right table has no values that correspond to the left table.
  93. The right outer join evaluates the right table against the left table.
  94. The self-referencing foreign key is the primary key of a table used in that same table for another purpose.
  95. A UNION combines the result of two or more queries into one table, based on what you specify in the column list of the SELECT.
  96. UNION can only take one order by at the end of the statement.
  97. SQL’s rule of UNION: the number of columns in each select statement must match; the data types in the columns need to either be the same, or be convertible to each other.
  98. Union all works exactly the same way as UNION, except it returns all the values from the columns, rather than one instance of each value that is duplicated.
  99. Intersect returns only those columns that are in the first query and also in the second query
  100. Except returns only those columns that are in the first query, but not in the second query.
  101. A check constraint restricts what values you can insert into a column. It uses the same conditionals as a WHERE clause.
  102. A constraint is a restriction on what you can insert into a column. Constraints are added when we create a table.
  103. Check doesn't enforce data integrity in MySQL.
  104. A view is basically a table that only exists when you use the view in a query, It’s considered as a virtual table because it acts like a table, and the same operations that can be performed on a table can be performed on a view. But the view table doesn't stay in the database. It gets created when we use the view and then deleted.
  105. Check option checks each query you try to insert or update to see if it’s allowed according to the where clause in your view.
  106. An updatable view includes all the NOT NULL columns from the table it references.
  107. A transaction is a set of SQL statements that accomplish a single unit of work.
  108. During a transaction, if all the steps can't be completed without interference, none of them should be completed.
  109. ACID—ATOMICITY: all of the pieces of the transaction must be completed, or none of them will be completed, you can't execute part of a transaction.
  110. ACID—CONSISTENCY: a complete transaction leaves the database in a consistent state at the end of the transaction.
  111. ACID—ISOLATION: it means that every transaction has a consistent view of the database regardless of other transactions taking place at the same time.
  112. ACID—DURABILITY: after the transaction, the database needs to save the data correctly and protect it from power outages or other threats.
  113. No changes will occur to the database until you commit.
  114. InnoDB and BDB are two possible ways that your RDBMS can store your data behind the scenes. Alter table your_table type=InnoDB;
  115. You can control exactly what uses can do to tables and columns with the grant statement
  116. Role, a role is a group of privileges. Roles let you group together specific privileges and assign them to more than one user.
  117. Greater than ALL finds any values larger than the biggest value in the set.
  118. Greater than ANY finds any values larger than the smallest value in the set.
  119. A temporary table exists from the time you create it until you drop it, or until the user session ends.

Head First SQL Your Brain on SQL读书笔记相关推荐

  1. 《Microsoft Sql server 2008 Internals》读书笔记--第九章Plan Caching and Recompilation(10)

    <Microsoft Sql server 2008 Internals>读书笔记订阅地址: http://www.cnblogs.com/downmoon/category/230397 ...

  2. 《Microsoft Sql server 2008 Internals》读书笔记--第八章The Query Optimizer(5)

    <Microsoft Sql server 2008 Internals>读书笔记订阅地址: http://www.cnblogs.com/downmoon/category/230397 ...

  3. 《Microsoft Sql server 2008 Internal》读书笔记--第八章The Query Optimizer(1)

    <Microsoft Sql server 2008 Interna>读书笔记订阅地址: http://www.cnblogs.com/downmoon/category/230397.h ...

  4. 《Microsoft Sql server 2008 Internals》读书笔记--第五章Table(4)

    <Microsoft Sql server 2008 Internals>索引目录: <Microsoft Sql server 2008 Internal>读书笔记--目录索 ...

  5. 《Microsoft Sql server 2008 Internals》读书笔记--第十一章DBCC Internals(11)

    <Microsoft Sql server 2008 Internals>读书笔记订阅地址: http://www.cnblogs.com/downmoon/category/230397 ...

  6. 《Microsoft Sql server 2008 Internals》读书笔记--第五章Table(6)

      <Microsoft Sql server 2008 Internals>读书笔记订阅地址: http://www.cnblogs.com/downmoon/category/2303 ...

  7. 《Microsoft Sql server 2008 Internals》读书笔记--第六章Indexes:Internals and Management(3)

    <Microsoft Sql server 2008 Internals>读书笔记订阅地址: http://www.cnblogs.com/downmoon/category/230397 ...

  8. 《Microsoft Sql server 2008 Internal》读书笔记--第七章Special Storage(3)

    <Microsoft Sql server 2008 Interna>读书笔记订阅地址: http://www.cnblogs.com/downmoon/category/230397.h ...

  9. [SQL必知必会] 读书笔记

    第1课 数据库 这一课介绍SQL究竟是什么,它能做什么事情. 1.1 数据库基础 下面是一些数据库概念的简要介绍,如果你刚开始接触数据库,可以由此了解必需的基本知识. 1.1.1 数据库 数据库这个术 ...

  10. SQL必知必会读书笔记

    <SQL必知必会> 1.SQL概述(概念.优点.数据库术语) * 日常生活中的数据库案例举例(例如在网站搜索东西:登录账号密码:取钱:) * 数据库概念:数据库database(以一种有组 ...

最新文章

  1. Docker介绍与安装使用(一)
  2. mysql dba工作笔记pdf_社区专家在线:Oracle数据库、MySQL、Db2 等数据库日常运维故障与性能调优在线答疑...
  3. 食品安全--牛奶和蛋白质浅谈
  4. 哈理工计算机学院保研,哈尔滨理工大学计算机科学与技术学院(专业学位)软件工程保研夏令营...
  5. 16. GD32F103C8T6入门教程-adc 使用教程2-dma+连续扫描方式采集数据
  6. Linux echo
  7. 【转】 ids for this class must be manually assigned before calling save()
  8. 无法在此计算机上安装vmware,电脑中虚拟机无法安装VMware Tools提示D盘找不到setup.exe如何解决...
  9. 我有你没有游戏例子100_50米的决赛圈里面藏着100个人?光子:知道什么叫质量局了吧!...
  10. 【图像去噪】基于matlab改进非局部均值红外图像混合噪声【含Matlab源码 1640期】
  11. ubuntu 16.04安装显卡驱动
  12. 【mitmproxy手机端App抓包】
  13. 翻译文章-让生活变得简单
  14. 010-flutter dart代码后台执行,没有界面的情况下
  15. MTU、MSS、TCP首部、IP首部
  16. 百度云不限速下载(Windows、Linux、Mac平台)
  17. Android 5.X 新特性详解(一)MD主题、Palette、视图阴影、Tinting(着色)和Clipping(裁剪)
  18. 微信小程序实现预览图片
  19. List的removeAll方法异常
  20. ENDNOTE中使用Adobe打开PDF后提示“只读无法保存”

热门文章

  1. paip.声音按键音延迟的解决
  2. paip.模块化设计中常用属性与常用方法
  3. 用户 'sa' 登录失败。 连接SQL2000出现的问题。
  4. 重要数据 | 数据分类和分级概念解析
  5. Python: 组合管理与蒙特卡洛方法实现
  6. Rust : standford 操作系统课与rust各种指针图
  7. CTP: 找ActionDay 和TradingDay说点事
  8. 从毛坯房到精装修,阿里云企业IT治理样板间助力云上管控和治理
  9. 【优化预测】基于matlab布谷鸟搜索算法优化SVM预测【含Matlab源码 1525期】
  10. 【图像去雾】基于matlab GUI直方图均衡化+Retinex理论图像去雾【含Matlab源码 1509期】