sql01 - 1 1 Writing Basic SQL Statements 1-2 Objectives...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 1 Writing Basic SQL Statements 1-2 Objectives After completing this lesson, you should After completing this lesson, you should be able to do the following: be able to do the following: List the capabilities of SQL SELECT statements Execute a basic SELECT statement Differentiate between SQL statements and iSQL*Plus commands 1-3 Capabilities of SQL SELECT Statements Selection Selection Projection Projection Table 1 Table 1 Table 2 Table 2 Table 1 Table 1 Table 1 Table 1 Join Join 1-4 Basic SELECT Statement SELECT [DISTINCT] {*, column [ alias ],. ..} FROM table; SELECT identifies what columns FROM identifies which table 1-5 Writing SQL Statements SQL statements are not case sensitive. SQL statements can be on one or more lines. Keywords cannot be abbreviated or split across lines. Clauses are usually placed on separate lines. Tabs and indents are used to enhance readability. 1-6 Selecting All Columns DEPTNO DNAME LOC--------- -------------- -------------10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON SQL> SELECT * 2 FROM dept; 1-7 Selecting Specific Columns DEPTNO LOC--------- -------------10 NEW YORK 20 DALLAS 30 CHICAGO 40 BOSTON SQL> SELECT deptno, loc 2 FROM dept; 1-8 Column Heading Defaults i SQL*Plus: Default heading justification : Center Default heading display: Uppercase SQL*Plus: Default justification Left: Date and character data Right: Numeric data Default display: Uppercase 1-9 Arithmetic Expressions Create expressions on NUMBER and DATE Create expressions on NUMBER and DATE data by using arithmetic operators. data by using arithmetic operators. Operator +-* / Description Add Subtract Multiply Divide 1-10 Using Arithmetic Operators SQL> SELECT ename, sal, sal+300 2 FROM emp; ENAME SAL SAL+300---------- --------- ---------KING 5000 5300 BLAKE 2850 3150 CLARK 2450 2750 JONES 2975 3275 MARTIN 1250 1550 ALLEN 1600 1900 ......
View Full Document

Page1 / 35

sql01 - 1 1 Writing Basic SQL Statements 1-2 Objectives...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online