12.07.2015 Views

Oracle SQL Developer

Oracle SQL Developer

Oracle SQL Developer

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Retrieving Data With Queries■■■■Format, perform calculations on, store, and print from query resultsExamine table and object definitionsDevelop and run batch scriptsPerform database administration6.1.2 Types of <strong>SQL</strong> StatementsAll operations performed on the information in an <strong>Oracle</strong> database are run using <strong>SQL</strong>statements. A statement consists partially of <strong>SQL</strong> reserved words, which have specialmeaning in <strong>SQL</strong> and cannot be used for any other purpose. For example, SELECT andUPDATE are reserved words and cannot be used as table names.A <strong>SQL</strong> statement is an instruction. The statement must be the equivalent of a complete<strong>SQL</strong> sentence, as in:SELECT last_name, department_id FROM employees;<strong>Oracle</strong> <strong>SQL</strong> statements are divided into several categories:■ Data Manipulation Language (DML) StatementsThese statements query, insert, update, delete data in tables.■ Transaction Control StatementsThese statements commit or rollback the processing of transactions. A group ofchanges that you make is referred to as a transaction.■Data Definition Language (DDL) StatementsThese create, alter, and drop database objects.6.2 Retrieving Data With QueriesYou can retrieve data from rows stored one or more database tables or views with aquery using the <strong>SQL</strong> SELECT statement. The SELECT statement retrieves the all of orpart of the column data from rows depending on the conditions that you specify inWHERE clauses. The group of columns that are selected from a table is referred to as theSELECT list.■■■■■■Displaying Data Using the SELECT StatementUsing Character Literals in <strong>SQL</strong> StatementsUsing a Column Alias to Change Headings When Selecting DataRestricting Data Using the WHERE ClauseSorting Data Using the ORDER BY ClauseDisplaying Data From Multiple Tables6.2.1 Displaying Data Using the SELECT StatementWith the <strong>SQL</strong> SELECT statement, you can query and display data of tables in adatabase.Example 6–1 shows how to use SELECT to retrieve data from the employees table. Inthis example, the data for all columns in a row (record) of the employees table isretrieved with the use of the wildcard (*) notation. Note the use of comments to6-2 <strong>SQL</strong> <strong>Developer</strong> Online Help

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!