Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 87ed071

Browse files
committed
longer syntax for select
1 parent cdc13a7 commit 87ed071

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

Week1/README.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ his 24th birthday works in Facebook and lives in Redmond.
8383

8484
### DBMS implementations
8585

86-
* ** MySQL **
86+
* **MySQL**
8787
* PostgreSQL
8888
* MongoDB (NoSQL)
8989
* Cassandra (NoSQL)
@@ -120,20 +120,34 @@ INSERT INTO table_name VALUES(value1, value2 [,value3,...]);
120120

121121
### See the content : SELECT
122122

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
128124
```
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.
132144
```
133145

134146
### INSERT and SELECT together
135147

136148
```
149+
Example:
150+
137151
INSERT INTO 'employees' ('shop_id', 'gender', 'name', 'salary')
138152
SELECT 3,
139153
LEFT(gender, 1),

0 commit comments

Comments
 (0)