Presentation is loading. Please wait.

Presentation is loading. Please wait.

SQL LANGUAGE TUTORIAL Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.

Similar presentations


Presentation on theme: "SQL LANGUAGE TUTORIAL Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha."— Presentation transcript:

1 SQL LANGUAGE TUTORIAL Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha

2 Basic Syntax of SQL Language SELECT attribute name(s) FROM table name WHERE comparison predicate (Boolean expression) GROUP BY attribute name HAVING comparison predicate ORDER BY attribute name

3 Create Tables

4 SELECT ALL records

5 Formula Like & DISTINCT

6 SELECT specific records with conditions

7 SQL ORDER BY

8 SQL UPDATE UPDATE table name SET column1 = value, column2 = value2,… WHERE comparison predicate (Boolean expression)

9 AVG() - Returns the average value COUNT() - Returns the number of rows FIRST() - Returns the first value LAST() - Returns the last value MAX() - Returns the largest value MIN() - Returns the smallest value SUM() - Returns the sum SQL IN OPERATOR

10 SQL Alias

11 SQL Joins  INNER JOIN: Return rows when there is at least one match in both tables  LEFT JOIN: Return all rows from the left table, even if there are no matches in the right table  RIGHT JOIN: Return all rows from the right table, even if there are no matches in the left table SELECT column_name(s) FROM table_name1 JOIN_TYPES table_name2 ON table_name1.column_name = table_name2.column_name

12 SQL INNER JOIN

13 SQL LEFT JOIN

14 SQL RIGHT JOIN

15 SQL GROUP BY Statement

16 SQL HAVING Clause

17 PosgreSQL Arrays (1)

18 PosgreSQL Arrays (2)

19 PosgreSQL Arrays (3)

20 PosgreSQL Composite Types


Download ppt "SQL LANGUAGE TUTORIAL Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha."

Similar presentations


Ads by Google