📓 intro to sql
- what are relational databases? a collection of tables, where each table represents exactly one type of entity
- a table can have multiple columns and multiple rows
- each column = an attribute about all entities, each row = information about an entity
- what's SQL?
- # Structured
# Query
# Language
- notes from http://datacamp.com/tracks/sql-fundamentals
- one of the primary usage of SQL is to query databases
- ## select single column
- common queries & keywords
- SELECT [column_name]
FROM [table_name];
- ## select all columns (*)
- SELECT *
FROM [DB_name];
- SELECT & FROM are keywords. keywords are not case sensitive but it's good practice to use uppercase
- good practices
- SELECT DISTINCT [column_1]
FROM [DB_name];
- SELECT *
FROM [DB_name]
LIMIT 10;
- SELECT COUNT([column_1])
FROM [DB_name];
- SELECT COUNT(*)
FROM [DB_name];
- use '<>' for not equal
- you need to specify the column for every condition, so the following is invalid: 'WHERE [column_1] > X AND < Y'
📓 intro to sql
- what are relational databases? a collection of tables, where each table represents exactly one type of entity
- a table can have multiple columns and multiple rows
- each column = an attribute about all entities, each row = information about an entity
- what's SQL?
- # Structured
# Query
# Language
- notes from http://datacamp.com/tracks/sql-fundamentals
- one of the primary usage of SQL is to query databases
- ## select single column
- common queries & keywords
- SELECT [column_name]
FROM [table_name];
- ## select all columns (*)
- SELECT *
FROM [DB_name];
- SELECT & FROM are keywords. keywords are not case sensitive but it's good practice to use uppercase
- good practices
- SELECT DISTINCT [column_1]
FROM [DB_name];
- SELECT *
FROM [DB_name]
LIMIT 10;
- SELECT COUNT([column_1])
FROM [DB_name];
- SELECT COUNT(*)
FROM [DB_name];
- use '<>' for not equal
- you need to specify the column for every condition, so the following is invalid: 'WHERE [column_1] > X AND < Y'