@@ -83,7 +83,7 @@ his 24th birthday works in Facebook and lives in Redmond.
83
83
84
84
### DBMS implementations
85
85
86
- * ** MySQL **
86
+ * ** MySQL**
87
87
* PostgreSQL
88
88
* MongoDB (NoSQL)
89
89
* Cassandra (NoSQL)
@@ -120,20 +120,34 @@ INSERT INTO table_name VALUES(value1, value2 [,value3,...]);
120
120
121
121
### See the content : SELECT
122
122
123
- * FROM clause : multiple tables
124
- * WHERE clause : Multiple conditions(AND, OR, NOT) Operators ( =, <>, BETWEEN, LIKE, IN)
125
- * Aggregation : SUM, AVG, COUNT
126
- * Joins : Natural join, inner join, left outer and right outer join
127
- #### Simple SYNTAX for a single table
123
+ #### SYNTAX
128
124
```
129
- SELECT */column_name FROM TABLE
130
- WHERE condition1 [AND/OR
131
- condition2 ...];
125
+ SELECT */column_1,column_2...
126
+ FROM table_1
127
+ [INNER | LEFT |RIGHT] JOIN table_2 ON conditions
128
+ WHERE conditions
129
+ GROUP BY group
130
+ HAVING group_conditions
131
+ ORDER BY column_1 [ASC | DESC]
132
+ LIMIT offset, row_count
133
+
134
+ The SELECT statement is composed of several clauses:
135
+
136
+ - SELECT chooses which columns of the table you want to get the data.
137
+ - FROM specifies the table from which you get the data.
138
+ - JOIN gets data from multiple table based on certain join conditions.
139
+ - WHERE filters rows to select.
140
+ - GROUP BY group rows to apply aggregate functions on each group.
141
+ - HAVING filters group based on groups defined by GROUP BY clause.
142
+ - ORDER BY specifies the order of the returned result set.
143
+ - LIMIT constrains number of returned rows.
132
144
```
133
145
134
146
### INSERT and SELECT together
135
147
136
148
```
149
+ Example:
150
+
137
151
INSERT INTO 'employees' ('shop_id', 'gender', 'name', 'salary')
138
152
SELECT 3,
139
153
LEFT(gender, 1),
0 commit comments