120 likes | 467 Views
BASIS DATA I/2009-GENAP. SQL SELECT STATEMENT. Oleh Satrio Agung Wicaksono, S.Kom., M.Kom. SQL SELECT STATEMENT. Objective. List the capabilities of SQL SELECT statements Execute a basic SELECT statement. SQL SELECT STATEMENT. Capabilities of SQL SELECT Statements. Projection. Selection.
E N D
BASIS DATA I/2009-GENAP SQL SELECT STATEMENT Oleh Satrio Agung Wicaksono, S.Kom., M.Kom BASIS DATA I/2009-GENAP
SQL SELECT STATEMENT Objective • List the capabilities of SQL SELECT statements • Execute a basic SELECT statement BASIS DATA I/2009-GENAP
SQL SELECT STATEMENT Capabilities of SQL SELECT Statements Projection Selection Table 1 Table 1 Join Table 2 Table 1 BASIS DATA I/2009-GENAP
SQL SELECT STATEMENT Basic SELECT Statement • SELECT identifies the columns to be displayed • FROM identifies the table containing those columns SELECT *|{[DISTINCT] column|expression [alias],...} FROM table; BASIS DATA I/2009-GENAP
SQL SELECT STATEMENT Selecting All Columns SELECT * FROM departments; BASIS DATA I/2009-GENAP
SQL SELECT STATEMENT Selecting Specific Columns SELECT department_id, location_id FROM departments; BASIS DATA I/2009-GENAP
SQL SELECT STATEMENT Writing SQL Statements • SQL statements are not case-sensitive. • SQL statements can be on one or more lines. • Keywords cannot be abbreviated or splitacross lines. • Clauses are usually placed on separate lines. • Indents are used to enhance readability. BASIS DATA I/2009-GENAP
SQL SELECT STATEMENT Arithmetic Expressions BASIS DATA I/2009-GENAP
… SQL SELECT STATEMENT Using Arithmetic Operators SELECT last_name, salary, salary + 300 FROM employees; BASIS DATA I/2009-GENAP
… … SQL SELECT STATEMENT Operator Precedence SELECT last_name, salary, 12*salary+100 FROM employees; SELECT last_name, salary, 12*(salary+100) FROM employees; BASIS DATA I/2009-GENAP
P E N U T U P Terima kasih BASIS DATA I/2009-GENAP