modifies data in database. retrieves. . ‡ Relational database ± Collection of two-dimensional tables. ‡ Database ± An organized collection of data or information.Key Terms ‡ Data ± Any important information like an employee¶s salary. ‡ DBMS ± Database Management System ± A Program that stores.

Relational Database Components .

How a database is created? Model of system in client¶s mind Entity model of client¶s model Table model of entity model Oracle server Entity becomes a table Attribute becomes columns of a table Tables on disk .

´ . Some departments do not yet have assigned employees«. .ER Diagram ± ER model consists of the various entities in a business and the relationships among them. . Assign one or more employees to a department . . . . . EMPLOYEE #* number * name o job title assigned to DEPARTMENT #* number * name composed of o location ± Scenario: ‡ ³.´ ‡ ³.

Relating Multiple Tables ± Each row of data in a table is uniquely identified by a primary key. ± You can logically relate data from multiple tables using foreign keys. Table name: DEPARTMENTS Table name: EMPLOYEES « Primary key Foreign key Primary key .

Relational Database Terminology 3 2 4 5 6 1 .

Using SQL to Query Your Database ‡ Structured query language (SQL) is: ± The ANSI standard language for operating relational databases ± Efficient. easy to learn.) SELECT department_name FROM departments. and use ± Functionally complete (With SQL. and manipulate data in the tables. you can define. Oracle server . retrieve.

text from xxx_temp where id < 10 Delete: delete from xxx_temp where id < 10 .CreateReadUpdateDelete Create: insert into xxx_temp Update: update xxx_temp set id = 4 where id < 10 values (2. Read: select id. 'Test 2').

SQL Statements SELECT INSERT UPDATE DELETE MERGE CREATE ALTER DROP RENAME TRUNCATE COMMENT GRANT REVOKE COMMIT ROLLBACK SAVEPOINT Data manipulation language (DML) Data definition language (DDL) Data control language (DCL) Transaction control .

Oracle 9i Components .

(HR) Schema generally used for training DEPARTMENTS department_id department_name manager_id location_id LOCATIONS location_id street_address postal_code city state_province country_id JOB_HISTORY employee_id start_date end_date job_id department_id EMPLOYEES employee_id first_name last_name email phone_number hire_date job_id salary commission_pct manager_id department_id COUNTRIES country_id country_name region_id job_id job_title min_salary max_salary JOBS REGIONS region_id region_name .

or a date that is included in the SELECT statement. Null is not the same as zero or a blank space. ‡ Keywords cannot be split across lines or abbreviated. ‡ Keywords typically are entered in uppercase. . Zero is a number and blank space is a character. ‡ SQL statements can be entered on one or many lines. ‡ Date and character literal values must be enclosed within single quotation marks. unassigned. such as table names and columns names are entered in lowercase. unknown. or inapplicable. The data entered is case sensitive. ‡ Null is a value that is unavailable. ‡ Clauses are usually placed on separate lines for readability and ease of editing. all other words. ‡ A literal is a character. a number. ‡ Indents should be used to make code more readable.Key Points For SQL Statements ‡ SQL statements are not case-sensitive.

Sign up to vote on this title
UsefulNot useful