Udacity: Intro to Relational Databases
The syntax of the select statement with a where clause:
select columns from tables where condition ;
keyword + columns+ keyword +tables + row restriction;
Columns are separated by commas,; use * to select all columns.
where 条件查询可以用and or not; != 代表不等于
We can switch between the expression form (not X) and (not Y) and the form not (X or Y)
例子
select name from users where name !='ihower' and name !="roy";
select name from users where not(name = 'ihower') and not(name = 'roy');
comparison operators
< less than
> greater than
!= not equal
<= less than or equal
SQL uses = instead of == to represent equality.
用SQL创建表格:例子:
Create table animals (
name text,
species text,
birthdate date
);
⚠️ :In SQL we always put string and date values inside single quotes.
SELECT clauses
where :表示