Oracle Database 10g Express

Similar documents
Managing Your Database Using Oracle SQL Developer

Including Dynamic Images in Your Report

Manipulating Database Objects

Self-Demo Guide. Oracle ilearning and HTML DB

Introduction to Oracle

Architecture. Architecture. Introduction to Oracle 10g Express Edition. Help

SQL Data Definition Language: Create and Change the Database Ray Lockwood

Course Outline and Objectives: Database Programming with SQL

Database Foundations. 6-1 Introduction to Oracle Application Express. Copyright 2015, Oracle and/or its affiliates. All rights reserved.

Mastering phpmyadmiri 3.4 for

DB2 for z/os Stored Procedure support in Data Server Manager

Data Modelling and Databases. Exercise Session 7: Integrity Constraints

Lab # 2. Data Definition Language (DDL) Eng. Alaa O Shama

Database Programming with SQL

Oracle Database 10g: Introduction to SQL

ORACLE DATABASE 12C INTRODUCTION

Lecture 07. Spring 2018 Borough of Manhattan Community College

Oracle Application Express Users Guide

Lab # 4. Data Definition Language (DDL)

Oracle Application Express Student Guide

CIS 207 Oracle - Database Programming and SQL HOMEWORK: # 13

Assignment 6. This lab should be performed under the Oracle Linux VM provided in the course.

Enterprise Reporting -- APEX

Database Foundations. 6-3 Data Definition Language (DDL) Copyright 2015, Oracle and/or its affiliates. All rights reserved.

SQL Commands & Mongo DB New Syllabus

Using DDL Statements to Create and Manage Tables. Copyright 2004, Oracle. All rights reserved.

Sql 2008 Copy Table Structure And Database To

SELF TEST. List the Capabilities of SQL SELECT Statements

Using DDL Statements to Create and Manage Tables. Copyright 2004, Oracle. All rights reserved.

VS2010 C# Programming - DB intro 1

Oracle Database Express Edition

Introduction to Databases and SQL

SQL Server 2008 Tutorial 3: Database Creation

The Relational Model

Real Application Security Administration

Sample Database Table Schemas 11g Release 2 Pdf

DB2 9 DBA exam 731 prep, Part 3: Database access

EE221 Databases Practicals Manual

Information Systems Engineering. SQL Structured Query Language DDL Data Definition (sub)language

Building Database-Centric Web Applications Using. Oracle HTML DB

EGCI 321: Database Systems. Dr. Tanasanee Phienthrakul

User's Guide c-treeace SQL Explorer

DB2 9 DBA exam 731 prep, Part 3: Database access

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Oracle SQL. murach s. and PL/SQL TRAINING & REFERENCE. (Chapter 2)

Relational databases and SQL

Oracle MOOC: SQL Fundamentals

INDEX. 1 Basic SQL Statements. 2 Restricting and Sorting Data. 3 Single Row Functions. 4 Displaying data from multiple tables

COSC 304 Introduction to Database Systems SQL DDL. Dr. Ramon Lawrence University of British Columbia Okanagan

Department of Computer Science University of Cyprus. EPL342 Databases. Lab 2

Using DDL Statements to Create and Manage Tables. Copyright 2006, Oracle. All rights reserved.

PL/SQL Developer 7.0 New Features. December 2005

Série n 6 Bis : Ateliers SQL Data Modeler (Oracle)

Oracle Database Express Edition

Pl Sql Copy Table From One Schema To Another

Babu Madhav Institute of Information Technology 2015

Table of Contents. PDF created with FinePrint pdffactory Pro trial version

Unit 27 Web Server Scripting Extended Diploma in ICT

1- a> [5pts] Create the new table by writing and executing a full SQL DDL statement based on the following schema:

Chapter 13 : Informatics Practices. Class XI ( As per CBSE Board) SQL Commands. New Syllabus Visit : python.mykvs.in for regular updates

Creating a PDF Report with Multiple Queries

Database Programming with SQL

Oracle Syllabus Course code-r10605 SQL

D B M G. SQL language: basics. Managing tables. Creating a table Modifying table structure Deleting a table The data dictionary Data integrity

Create a simple database with MySQL

Working with Columns, Characters and Rows. Copyright 2008, Oracle. All rights reserved.

Full file at

The URL of the whole system is:

Database Programming - Section 10. Instructor Guide

Relational Model. Topics. Relational Model. Why Study the Relational Model? Linda Wu (CMPT )

SQL: Concepts. Todd Bacastow IST 210: Organization of Data 2/17/ IST 210

APEX Times Ten Berichte. Tuning DB-Browser Datenmodellierung Schema Copy & Compare Data Grids. Extension Exchange.

Chapter 7. Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel

CS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen

Physical Design of Relational Databases

Sql 2008 Copy Tables Structure And Database To Another

Using Relational Databases for Digital Research

Chapter # 7 Introduction to Structured Query Language (SQL) Part I

Database Programming with SQL

Creating and Managing Tables Schedule: Timing Topic

Oracle Application Express SQL Workshop Guide. Release 18.1

7. Data Privacy Option for Oracle E-Business Suite

An Introduction to Structured Query Language

This presentation is for informational purposes only and may not be incorporated into a contract or agreement.

Talend Open Studio for MDM Web User Interface. User Guide 5.6.2

Database Administration and Management

Full file at

Data Infrastructure IRAP Training 6/27/2016

An Introduction to Structured Query Language

Relational Model. IT 5101 Introduction to Database Systems. J.G. Zheng Fall 2011

Lab Assignment 9 CIS 208A PL/SQL Programming and SQL

Constraints. Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers. John Edgar 2

AN INTRODUCTION TO WEB PROGRAMMING. Dr. Hossein Hakimzadeh Department of Computer and Information Sciences Indiana University South Bend, IN

SQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas

Integrity and Security

The Relational Model 2. Week 3

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

Oracle Exam 1z0-882 Oracle Certified Professional, MySQL 5.6 Developer Version: 7.0 [ Total Questions: 100 ]

RESTRICTING AND SORTING DATA

Mysql Query Browser Export Table Structure

Transcription:

Oracle Database 10g Express This tutorial prepares the Oracle Database 10g Express Edition Developer to perform common development and administrative tasks of Oracle Database 10g Express Edition. Objectives After taking this tutorial, you should be able to: Install Oracle Database 10g Express Edition Access the Oracle Database Home Page Manage Database Objects Access and Manipulate Data What is Oracle Database 10g Express Edition? Oracle Database 10g Express Edition (Oracle Database XE) is a free, downloadable version of the world's most capable relational database. Oracle Database XE is easy to install and easy to manage. With Oracle Database XE, you use the Database Home Page, an intuitive browser-based interface, to administer the database; create tables, views, and other schema objects; import, export, and view table data; run queries and SQL scripts; and generate reports. Oracle Database XE includes Oracle HTML DB 2.1, a declarative, graphical development environment for creating database-centric Web applications. In addition to HTML DB 2.1, you can use popular Oracle and third-party languages and tools to develop your Oracle Database XE applications. Installation Installation of Oracle Database 10g Express Edition is extremely easy and can be done in less than 15 minutes. Oracle Database 10g Express Edition can be installed on both Linux and Windows platforms What to Do First In this module, you learn how to log in to the Oracle Database 10g Express Edition browser-based user interface, create administration and database users. Users access Oracle Database 10g Express Edition through database user accounts. Some of these accounts are automatically created administrative accounts accounts with database administration privileges. You log in with these accounts to create and manage other user accounts and to maintain database security. Creating a New Administration Account The installation process creates an account named SYSTEM. This account is considered an administrator account because it has DBA access.

Using an Oracle best practice, try to create its own administrator account and password so that you can create database user accounts when needed!!! 1. Log in as SYSTEM 2. Select Administration>Database Users>Create User 3. Input user information, check the DBA role for user and click Create Create your own administrator account! Creating a New Database User Account You can now log in with your administration account and create the necessary developer user accounts. Another user needs access to develop his portion of the application later, so you will create a new account for him!!! The same steps but don t check the DBA role for user. Create a user account! Loading Data You have an sql file manager that contains all the necessary commands and insert statements to load into the Oracle Database 10g Express Edition database. The script that will be loaded is called http://software.ucv.ro/~soimu_anca/dd/sample.sql This data contains information about each employee and about that employee's department. 1. Log in with your account 2. Select SQL>SQL Scripts> Upload 3. Select the file you want to upload and click Upload 4. Select the file icon and click Run twice to execute the script 5. Review the results of the execution 6. Browse the database objects and data Working with Database Objects Oracle Database XE provides an organized mechanism for storing, managing, and retrieving information. Tables are the basic storage structure for holding business data. In this module, you learn how to create tables and work with them. You may want to modify data entered in tables. You may also want to maintain integrity with the data. Sometimes, you may want to remove tables that are no longer useful. Creating tables You create tables with the SQL CREATE TABLE statement. With Oracle Database XE, you have two options for creating tables. Use the graphical interface that generates the SQL statement

Enter the CREATE TABLE statement in the SQL Workshop tool When creating tables, you must provide: Table name Column name(s) Data types for each column Guidelines for creating tables: Table and column naming rules Must start with a letter, which is followed by a sequence of letters, numbers, _, #, or $ Must be 1 to 30 characters long Must not be an Oracle server reserved password Most common data types VARCHAR2 NUMBER DATE TIMESTAMP CHAR You can also set up constraints on your columns to control the data in them. 1. Creating Tables by Using the Object Browser Create the DEPENDENTS table, which will contain the following columns: Id, FirstName, LastName, BirthDate, Relation, Gender, Benefits, and RelativeId. In the DEPENDENTS table, no two rows have the same ID. The Gender column holds only one value of M or F. Also, the Benefits column stores large blocks of character data. 1. Log in to Oracle Database XE 2. Click the Object Browser 3. Go to Create. Click the Table link 4. Enter the table name and column definitions. Click Next 5. Specify the primary key information. Click Next 6. Specify the foreign key information. Click Add 7. Proceed to check constraint information. Click Finish 8. On the conformation page click Create

2. Creating Tables Using SQL Sheila needs to create the AUDIT_RECORD_TB1 table. This table will contain two columns. The user_value column is of the data type varchar2, and the date_recorded column is of the data type timestamp. Later, Sheila will use this table to record audit information when the salary column in the EMPLOYEES table changes. 1. Navigate to Oracle Database>Home Page 2. Click the SQL command 3. Go to SQL Commands 4. Click Enter Command 5. Type the SQL command 6. Click Run 3. Creating a Copy of a Table To copy the EMPLOYEES table so that she can practice without affecting the real data. Create a copy of the table by using the Object Browser. 4. Modifying Tables You can modify tables using the SQL ALTER TABLE statement. You may need to change the table structure due to any of the following reasons: You omitted a column. Your column definition needs to be changed. You need to remove columns. The ALTER TABLE statement is used to: Add a new column Modify an existing column Define a default value for the new column Drop a column Manage constraints In Oracle Database XE, you can modify tables: Using the Object Browser Using the SQL Workshop tool 5. Adding a New Column Add a new column BirthDate of Date type to the EMPLOYEES table by using the Object Browse. 6. Managing Constraints What Are Constraints? Data integrity ensures the consistency and correctness of data stored in a database. Such integrity can be enforced by incorporating business rules. Constraints are the rules that are enforced on data stored in a table.

Why Should I Use Constraints? You can use constraints to do the following: Enforce rules on the data in a table whenever a row is updated, inserted, or deleted from that table Prevent the deletion of a table if there are dependencies from other tables Types of Constraints: PRIMARY KEY The PRIMARY KEY constraint is a column or a set of columns that uniquely identifies each row in a table. This constraint enforces uniqueness of the column or column combination. It ensures that no column that is part of the primary key can contain a null value. A null value is a value that does not exist. For example, in the DEPENDENTS table, the column ID is the primary key.this column will not allow either a duplicate value or a null value. FOREIGN KEY The FOREIGN KEY constraint designates a column or a combination of columns as a foreign key. It establishes a relationship between a primary key or a unique key in the same table or different table. A foreign key enforces that the value within the column matches the value in the relationship column. For example, the RelativeId column in the DEPENDENTS table refers to the EMPLOYEES table. You cannot delete a record in the EMPLOYEES table whose RelativeId is used in the DEPENDENTS table. Also, with a non-existing RelativeId in the EMPLOYEES table, you cannot insert a record into the DEPENDENTS table. CHECK

The CHECK constraint enforces integrity by restricting the values to be inserted in a column. It defines a condition that each row must sastisfy. You can define multiple check constraints on a single column. Also, you can apply a single check constraint to multiple columns. For example, when you impose the CHECK constraint on the Gender column in the DEPENDENTS table, you can specify that the only valid values are either M or F. UNIQUE The UNIQUE constraint requires that no two rows of a table can have duplicate values in a specified column or a set of columns. A table can have more than one unique key. If the UNIQUE constraint comprises more than one column, then the group of columns is called a coomposite key. For example, you can impose the UNIQUE constraint on the Email column of the EMPLOYEES table. You ensure that each employee has a unique email ID NOT NULL Constraints can be enforced at two levels: Column level Table level A constraint can be created with either of the following statements: CREATE TABLE ALTER TABLE With the ALTER TABLE statement, you can disable or enable the imposed constraint without dropping it or re-creating it: Disable a constraint by using the DISABLE clause. Enable a constraint by using the ENABLE clause. 1. Manage the constraints on the DEPENDENTS table by using the Object Browser: 1. Navigate to Oracle Database XE>Home Page 2. Click the Object Browser arrow 3. Go to Browse

4. Click the Table link 5. Click the table name 6. Click Constraints 7. Click Create 8. Specify the constraint information 9. Click Next 10. Click Finish Create two constaints on table Dependents: 1. Dependents_CON: the Gender column to take the values ( M, F ) and 2. Dependents_FK: the relativeid is the foreign key( reference Employees(Employee_ID)) 2.Disable the foreign key constraint on the DEPENDENTS table by using the appropriate SQL statement. 1.Click the SQL arrow 2.Go to SQL Commands 3. Click Enter Command: SQL Alter table dependents disable constraint dependents_fk 4.Type the SQL command 5.Click Run Accessing Data In this module, you learn how to retrieve data from tables. The SQL SELECT statement is used to access and report data back from the XE tables. This is known as "querying" the data. In XE, you can either write SELECT statements using the SQL Workshop tool, or you can use the Query Builder tool to build queries with a GUI interface. 1. Building Queries Use the SQL Workshop tool to type her SELECT statements Use the Query Builder tool to build the query graphically Bibliografie: www.oracle.com