- 博客(17)
- 收藏
- 关注
原创 SQL Lesson 17: Altering tables 表格改变
Altering table to add new column(s) 增加新列ALTER TABLE mytable ADD column DataType OptionalTableConstraint 增加列,数据类型,可选表格约束 DEFAULT default_value; 在数列中没有其他的数值时,能表示所有的数据,相当于填充的角色在这里Altering ...
2018-04-24 21:27:11 412
原创 SQL Lesson 16: Creating tables 表格创建
Create table statement w/ optional table constraint and default valueCREATE TABLE IF NOT EXISTS mytable ( column DataType TableConstraint DEFAULT default_value, another_column DataType TableC...
2018-04-24 17:57:50 229
原创 SQL Lesson 14: Updating rows 更新行的内容
Update statement with valuesUPDATE mytableSET column = value_or_expr, other_column = another_value_or_expr, …WHERE condition;Delete statement with conditionDELETE FROM mytableWHERE cond...
2018-04-23 22:31:49 186
原创 SQL Lesson 13: Inserting rows 插入行
SQL schemas SQL模式Insert statement with values for all columns 插入行的表述INSERT INTO mytableVALUES (value_or_expr, another_value_or_expr, …), (value_or_expr_2, another_value_or_expr_2, …),Insert...
2018-04-23 21:50:03 338
原创 SQL Lesson 12: Order of execution of a Query 对于前几章的内容进行总结
Complete SELECT querySELECT DISTINCT column, AGG_FUNC(column_or_expression), …FROM mytable JOIN another_table ON mytable.column = another_table.column WHERE constraint_expression G...
2018-04-23 21:05:30 249
原创 SQL Lesson 11: Queries with aggregates (Pt. 2), having语句的使用
SELECT role, SUM(years_employed)FROM employeesGROUP BY roleHAVING role = "Engineer";HAVING 语句的使用
2018-04-23 18:30:16 405
原创 SQL Lesson 10: Queries with aggregates (Pt. 1) 聚合函数
Select query with aggregate 聚合 functions over all rowsSELECT AGG_FUNC(column_or_expression) AS aggregate_description, …FROM mytableWHERE constraint_expression;group by 的神奇用法通过这个可以解决很多不同的问题SELECT bu...
2018-04-23 15:16:57 485
原创 SQL Lesson 9: Queries with expressions
Example query with expressionsSELECT particle_speed / 2.0 AS half_particle_speedFROM physics_dataWHERE ABS绝对值(particle_position) * 10.0 > 500;Select query with expression aliasesSELECT col_expr...
2018-04-23 01:05:43 231
原创 SQL Lesson 8: A short note on NULLs
Select query with constraints(约束) on NULL values(值)SELECT column, another_column, …FROM mytableWHERE column IS/IS NOT NULLAND/OR another_conditionAND/OR …;主要介绍的是关于NULL 这个空值的选择这个是关于一个两个图标的信息护取的题目,...
2018-04-22 22:20:56 226
原创 SQL Lesson 7: OUTER JOINs
Select query with LEFT/RIGHT/FULL JOINs on multiple tablesSELECT column, another_column, …FROM mytableINNER/LEFT/RIGHT/FULL JOIN another_table ON mytable.id = another_table.matching_idWHERE c...
2018-04-22 22:01:49 302
原创 SQL multi-table queries with JOINS
Select query with INNER JOIN on multiple tablesSELECT column, another_table_column, …FROM mytableINNER JOIN another_table ON mytable.id = another_table.idWHERE condition(s)ORDER BY column, …...
2018-04-22 19:50:32 364
原创 SQL
数据库和SQL数据库是逻辑上的概念,他们是一对相互关联的数据,数据组成了表(table)数据库是表的集合,一个数据中可以放置多张表,我们给每一表命名,表和表之间会有所联系联系就是数据能够对应匹配,正式名称为联接,对应的操作叫做Join.ID 唯一的标识符/主键,用来表示数据的唯一性 不会用显示的业务意义,就是一串单纯的数字,每一张表只能有一个主键使用ID进行联接数据库中,表的名字和字段...
2018-04-22 17:52:15 90
原创 SQL lesson4 提炼和排序
KEY WORD:distinct 独一无二的Select query with unique resultsSELECT DISTINCT column, another_column, …FROM mytableWHERE condition(s);SELECT DISTINCT director FROM moviesASCascending 上升的DESCdescending...
2018-04-22 00:33:00 178
原创 SQL lesson3 关键文字的选择
SELECT * 选择全部的内容FROM moviesWHERE title like "%toy %" 注意加双引号和百分号SELECT role, count(role) AS itemFROM employeesWHERE role="Artist"对于不同的like 和=的用法...
2018-04-21 21:48:41 163
原创 SQL 2 QUERIES WITH CONSTRAINST(条件)
Select query with constraintsselect column, another columnfrom mutablewhere conditionand/or another_conditionand/or
2018-04-21 20:15:48 233
原创 SQL lesson1 select column
SQLBOLT.COM我们最常用到的查询语句为1. SELECT query for a specific column SELECT column, another column FROM mytable2. select query for all cloumn SELECT * FROM mytable不分大小写 ...
2018-04-21 19:55:04 582
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人