1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu về introduction

34 146 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 34
Dung lượng 248,07 KB

Nội dung

I Introduction IĆ2 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder Course Objectives At the end of this course, you should be able to D Describe the relational database approach, concepts, terminology, and operators D Create database structures such as tables and views using Structured Query Language (SQL) D Store, retrieve, and update data in the database D Develop PL/SQL blocks of application code using Procedure Builder to manipulate data Introduction IĆ3 IĆ4 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder Course Outline The course starts with an overview The first module ends on Day with an optional summary covering the SQL and SQL*Plus content The second module ends on Day with an optional summary of the PL/SQL section DAY Lesson Selecting Rows Lesson Limiting Selected Rows Lesson Single Row Functions Lesson Displaying Data from Multiple Tables DAY Lesson Group Functions Lesson Subqueries Lesson Specifying Variables at Runtime Lesson Overview of Data Modeling and Database Design Lesson Creating Tables Lesson 10 Oracle Data Dictionary DAY Lesson 11 Manipulating Data Lesson 12 Altering Tables and Constraints Lesson 13 Creating Sequences Lesson 14 Creating Views Lesson 15 Creating Indexes Lesson 16 Controlling User Access Lesson 17 Summary of SQL and SQL*Plus (optional) Introduction IĆ5 IĆ6 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder Course Outline continued DAY Lesson 18 Overview of PL/SQL Lesson 19 Basics of Procedure Builder Lesson 20 Modularizing Programming with Subprograms Lesson 21 Developing a Simple PL/SQL Block Lesson 22 Interacting with Oracle DAY Lesson 23 Controlling Flow in PL/SQL Blocks Lesson 24 Processing Queries by Using Explicit Cursors Lesson 25 Error Handling Lesson 26 Summary of PL/SQL (optional) Introduction IĆ7 IĆ8 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder The Relational Database Concept The principles of the relational model were first outlined by Dr E F Codd in a June 1970 paper called “A Relational Model of Data for Large Shared Data Banks.” In this paper, Dr Codd proposed the relational model for database systems The more popular models used at that time were hierarchical and network, or even simple flat file data structures Relational database management systems (RDBMS) soon became very popular, especially for their ease of use and flexibility in structure In addition, there were a number of innovative vendors, such as Oracle, who supplemented the RDBMS with a suite of powerful application development and user products, providing a total solution Concepts of the Relational Model D Collections of objects or relations store the data D A set of operators can act on the relations to produce other relations D A relational database must possess data integrity so that its data must be accurate and consistent An example of a relation is a table To retrieve data from the tables, use relational operation SQL commands Relational Database Functions D Manage the storage of data D Control access to the data D Provide a means to retrieve and modify the data For more information, see The Relational Model for Database Management Version 2, E F Codd, Addison Wesley Introduction IĆ9 IĆ10 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder DSS Tools IĆ20 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder The Oracle Product Set All application development and end-user products available within the Oracle product set allow you to access the database, either directly or indirectly, through SQL commands Discoverer/2000 A set of products for end users and decision support analysts that supports rapid querying and reporting, multi-dimensional analysis of Data Warehousing, and powerful data mining through a low maintenance meta-layer Developer/2000 A set of application development tools that allow developers to create screen-based applications for users, reporting features, and graphical displays of charts, images, and drawings Designer/2000 A family of tools to aid the analysis, design, and generation of Oracle applications For more information, see Guide to Oracle Products and Services Introduction IĆ21 Server ÉÉÉÉ SQL and PL/SQL Scripts IĆ22 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder SQL, SQL*Plus, and PL/SQL SQL, SQL*Plus, and PL/SQL commands are used to access and manipulate data stored in an Oracle database SQL*Plus, SQL, and PL/SQL Language or Tool Description SQL A command language for communication with the Oracle7 Server from any tool or application Oracle SQL contains many extensions SQL*Plus An Oracle tool that recognizes and submits SQL and PL/SQL statements to the Server for execution and contains its own command language PL/SQL An Oracle procedural language for writing application logic and manipulating data outside the database Features of SQL D Can be used by a range of users, including those with little or no programming experience D Is a non-procedural language D Reduces the amount of time required for creating and maintaining systems D Is an English-like language Features of SQL*Plus D Accepts ad hoc entry of statements D Accepts SQL and PL/SQL input from files D Edits SQL statements with a line editor D Controls environmental settings D Formats query results into basic reports D Interacts with end users D Accesses remote databases Introduction IĆ23 IĆ24 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder SQL, SQL*Plus, and PL/SQL continued SQL is the industry standard language for relational databases The American National Standards Institute (ANSI) adopted it in 1986 The International Standards Organization (ISO) has also adopted it All major RDBMSs support some form of SQL and most RDBMS vendors intend to comply with the ANSI standard SQL Commands There are many commands available in SQL The table below describes the commands covered in this course Command Description SELECT Retrieves data from the database Most commonly used command INSERT UPDATE DELETE Enters new rows, changes existing rows, and removes unwanted rows from tables in the database, respectively Collectively known as Data Manipulation Language (DML) commands CREATE ALTER DROP RENAME TRUNCATE Sets up, changes, and removes data structures from tables Collectively known as Data Definition Language (DDL) commands COMMIT ROLLBACK SAVEPOINT Manage the changes made by DML statements Changes to the data can be grouped together into logical transactions GRANT REVOKE Gives or removes access rights to both the Oracle database and the structures within it Collectively known as Data Control Language (DCL) commands For more information, see Oracle7 Server SQL Reference, Release 7.3 and Oracle7 SQL Quick Reference Guide Introduction IĆ25 IĆ26 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder SQL, SQL*Plus, and PL/SQL continued SQL*Plus Command Categories Category Purpose Environment Affects the general behavior of SQL statements for the session Format Formats query results File manipulation Saves, loads, and runs script files Execution Sends SQL or PL/SQL commands from SQL buffer to Oracle7 Server Edit Modifies SQL commands in the buffer Interaction Allows users to create and pass variables to SQL statements, print variable values, and print messages to the screen Miscellaneous Various commands to connect to the database, manipulate the SQL*Plus environment, and display column definitions PL/SQL Block Structure PL/SQL provides a host of programming constructs to manipulate data Each group of commands is packaged in a PL/SQL block Block Section Description Header Contains the subprogram name, type, and arguments Only used for subprograms Declarative Contains the local identifiers for the block Executable Contains the SQL statements and PL/SQL control statements Exception Performs actions when errors occur Introduction IĆ27 IĆ28 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder Summit Sporting Goods Demonstration Tables The course is based on the fictitious Summit Sporting Goods Company The diagram on the facing page is an entity relationship (ER) model for Summit Sporting Goods Company In an effective business system data is divided into discrete categories or entities An ER model is an illustration of various entities in a business and the relationships between them The entity relationship model on the facing page represents the main tables and relationships covered in the course The business narrative describes the company’s database needs Business Narrative “I’m a manager of a sporting goods wholesale company that operates worldwide to fill orders of retail sporting goods stores The stores are our customers (some of our people prefer to call them our clients) Right now we have fifteen customers worldwide, but we’re trying to expand our customer base Our two biggest customers are Big John’s Sports Emporium in San Francisco, CA, USA, and Womansport in Seattle, Washington, USA For each customer, we must track an identification number and customer name We may track an address (including the city, state, postal code, and country) and phone number We maintain warehouses in different regions to best fill the orders of our customers For each order, we must track an order number We may track the date ordered, date shipped, and payment type when the information is available Right now, we have the world divided into five regions: North America, South America, Africa/Middle East, Asia, and Europe That’s all we track, just the region number and region name We try to assign each customer to a region so we’ll generally know the best location from which to fill each order Each warehouse must have a warehouse number We may track an address (including city, state, postal code, and country) and phone number We currently have only one warehouse per region, but we’re hoping to have more soon.” “I manage the order entry functions for our wholesale sporting goods business My department is responsible for placing and tracking the orders when our customers call For each department, we must track the department number and name Sometimes, our customers just mail us the orders when they are not in a rush, but most often they call us or fax us an order We are hoping to expand our business by providing immediate turnaround of order information to our clients We can promise to ship by the next day as long as the goods are in stock (or inventory) at one of our warehouse locations When the information is available, we track the amount in stock, the reorder point, maximum stock, the reason we are out of stock, and the date we restocked the item When the goods are shipped, we intend to fax the shipping information automatically through our shipping system No, I don’t manage that area Continued Introduction IĆ29 IĆ30 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder Summit Sporting Goods Demonstration Tables continued Business NarrativeĊcontinued My department just ensures that our customers have the correct billing information and verifies that their account is in good credit standing We may also record general comments about a customer.” “We make sure all the items the customers have requested are in stock For each item, we track an item number We may also track the item price, quantity, and quantity shipped if the information is available If they are in stock, we want to process the order and tell our clients what the order number is and how much their order total is If the goods are not in stock, the customer tells us whether we should hold the entire order for a full shipment, or to process the partial order.” “The accounting department is responsible for maintaining the customer information, especially for assigning new customer numbers My department is allowed to update the customer information only when a customer places an order and their billing or ship to addresses have changed No, we are not responsible for collections That’s all handled by accounts receivable I also think that the sales representatives get involved as their commission depends on customers who pay! For each sales representative, or employee, we must know the employe number and last name Occasionally, we need to know the first name, user name, start date, title, and monthly salary We may also track the employee’s commission percent and any comments about the individual.” “Our order entry personnel are well versed in our product line We hold frequent meetings with marketing so they can inform us of new products This results in greater customer satisfaction because our order entry operators can answer a lot of questions This is possible because we deal with a few select customers and maintain a specialty product line For each product, we must know the product number and name Occasionally, we must also know the description, suggested price, and unit of sale We would also like to track very long descriptions of our products and pictures of our products, when necessary.” Introduction IĆ31 IĆ32 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder Summary Relational database management systems are composed of objects They are managed by operations and governed by data integrity constraints Oracle Corporation produces products and services to meet your relational database management system needs The main product is the Oracle7 Server The Server allows you to store and manage information by using SQL and the PL/SQL engine for procedural constructs SQL Oracle7 Server supports ANSI standard SQL and contains extensions SQL is the language used to communicate with the Server to access, manipulate, and control data access SQL*Plus SQL*Plus is an Oracle tool to execute SQL and PL/SQL statements It also contains supporting commands to format queries, set the environment, and edit SQL commands in the SQL buffer PL/SQL The PL/SQL language extends the SQL language by offering block structured procedural constructs combined with SQL non-procedural capabilities Introduction IĆ33 IĆ34 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder [...]... generally cannot be changed D Foreign keys are based on data values and are purely logical, not physical pointers D A foreign key value must match an existing primary key value or else be NULL Introduction IĆ11 IĆ12 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder The Relational Database Concept continued Relational Database Properties A database is a collection of individual, named objects,... inserted Each column is uniquely named Column order is insignificant when storing data; specify the column order when the data is retrieved Field values cannot be broken into smaller components Introduction IĆ13 IĆ14 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder The Relational Database Concept continued Protect Data Integrity Ensure that users perform only operations that leave the database... unique Referential Foreign key values must match a primary key or be NULL Column Values in the column must match the defined datatype User-defined Values must comply with the business rules Introduction IĆ15 IĆ16 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder System Development Cycle From concept to production, develop a database by using the system development cycle The cycle contains... the working, tested software Write user documentation, help screens, and operations manual Transition Engage in a user acceptance testing phase Production Operate the production system Introduction IĆ17 Server É ÉÉ IĆ18 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder What Is Oracle? Oracle is a database company that offers a comprehensive set of application building and end-user products... a client personal computer while accessing flight data that is conveniently managed by an Oracle7 Server on a central computer For more information, see Oracle7 Server Concepts Manual Introduction IĆ19 DSS Tools IĆ20 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder The Oracle Product Set All application development and end-user products available within the Oracle product set allow you... drawings Designer/2000 A family of tools to aid the analysis, design, and generation of Oracle applications For more information, see Guide to Oracle Products and Services Introduction IĆ21 Server ÉÉÉÉ SQL and PL/SQL Scripts IĆ22 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder SQL, SQL*Plus, and PL/SQL SQL, SQL*Plus, and PL/SQL commands are used to access and manipulate data stored in... input from files D Edits SQL statements with a line editor D Controls environmental settings D Formats query results into basic reports D Interacts with end users D Accesses remote databases Introduction IĆ23 IĆ24 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder SQL, SQL*Plus, and PL/SQL continued SQL is the industry standard language for relational databases The American National Standards... the structures within it Collectively known as Data Control Language (DCL) commands For more information, see Oracle7 Server SQL Reference, Release 7.3 and Oracle7 SQL Quick Reference Guide Introduction IĆ25 IĆ26 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder SQL, SQL*Plus, and PL/SQL continued SQL*Plus Command Categories Category Purpose Environment Affects the general behavior of SQL... used for subprograms Declarative Contains the local identifiers for the block Executable Contains the SQL statements and PL/SQL control statements Exception Performs actions when errors occur Introduction IĆ27 IĆ28 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder Summit Sporting Goods Demonstration Tables The course is based on the fictitious Summit Sporting Goods Company The diagram on... stock, and the date we restocked the item When the goods are shipped, we intend to fax the shipping information automatically through our shipping system No, I don’t manage that area Continued Introduction IĆ29 IĆ30 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder Summit Sporting Goods Demonstration Tables continued Business NarrativeĊcontinued My department just ensures that our customers ... Develop PL/SQL blocks of application code using Procedure Builder to manipulate data Introduction IĆ3 IĆ4 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder Course Outline The course... Indexes Lesson 16 Controlling User Access Lesson 17 Summary of SQL and SQL*Plus (optional) Introduction IĆ5 IĆ6 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder Course Outline continued... Using Explicit Cursors Lesson 25 Error Handling Lesson 26 Summary of PL/SQL (optional) Introduction IĆ7 IĆ8 Introduction to Oracle: SQL and PL/SQL Using Procedure Builder The Relational Database

Ngày đăng: 03/12/2015, 07:46

TỪ KHÓA LIÊN QUAN

w