700 likes | 941 Views
Data Administration and Database Administration. University of California, Berkeley School of Information Management and Systems SIMS 257: Database Management. Final Project Requirements Review Fourth Generation Languages PHP implementation Object-Relational Extensions to SQL
E N D
Data Administration and Database Administration University of California, Berkeley School of Information Management and Systems SIMS 257: Database Management
Final Project Requirements Review Fourth Generation Languages PHP implementation Object-Relational Extensions to SQL Database Administration Lecture Outline
Final Project Requirements Review Fourth Generation Languages PHP implementation Object-Relational Extensions to SQL Database Administration Lecture Outline
Final Project Requirements • See WWW site: • http://sims.berkeley.edu/courses/is257/f04/index.html • Report on personal/group database including: • Database description and purpose • Data Dictionary • Relationships Diagram • Sample queries and results (Web or Access tools) • Sample forms (Web or Access tools) • Sample reports (Web or Access tools) • Application Screens (Web or Access tools)
Final Project Requirements Review Fourth Generation Languages PHP implementation Object-Relational Extensions to SQL Database Administration Lecture Outline
Fourth Generation Languages • 1st Generation -- Machine Language • 2nd Generation -- Assembly Languages • 3rd Generation -- High-Level Languages • 4th Generation -- Non-Procedural Languages • 5th Generation -- ?? Knowledge-based ?? Natural Language ?? • Where do Object-Oriented Languages fit??
Components of a 4GL for building routine applications… Application Parameters Data Specification Report Specification Feedback Screen Specification Rules Specification Procedural facility Testing tools/debugger Interpreter Optimizing compiler
Natural Language • Advantages of using NL • It encourages untrained users to start • It encourages upper-management use of computers • It reduces the time taken learning complex syntax • It lessens the frustration, bewilderment and anger caused by BAD COMMAND responses • It is likely to extend greatly the usage of computers James Martin, Fourth Generation Languages, 1985
It lacks precision It is not good for expressing precise and complex logic It is not good for expressing neat structures It encourages semantic overshoot It should be combined with other dialogue contructs that aid in the representation of precise logic and structures Natural Language Disadvantages of using NL Appropriate response to the disadvantage James Martin, Fourth Generation Languages, 1985
It takes substantial time to key in sentences Ambiguities are possible Substantial processing is needed Sentences and words can be abbreviated Speech input as well as typed input will be used The computer should detect and resolve ambiguities The processing should be on PC workstations. Processing is dropping rapidly in cost. Natural Language Disadvantages of using NL Appropriate response to the disadvantage James Martin, Fourth Generation Languages, 1985
Assumptions and Issues • Why 4GLs? • Are they still appropriate? • Are they still useful? • Is Cold Fusion a 4GL? • What about PHP? • Who needs them?
Diveshop PHP • The same interface (with minor differences) that we saw for ColdFusion has been implemented in PHP and MySQL • Address for the example is • http://dream.sims.berkeley.edu/~ray/Diveshop/index.php3 • To setup your own MySQL database you will need to use the “my.sims” interface to request a MySQL account and PHP access
Final Project Requirements Review Fourth Generation Languages PHP implementation Object-Relational Extensions to SQL Database Administration Lecture Outline
Object Relational Databases • Background • Object Definitions • inheritance • User-defined datatypes • User-defined functions
Object Relational Databases • Began with UniSQL/X unified object-oriented and relational system • Some systems (like OpenODB from HP) were Object systems built on top of Relational databases. • Miro/Montage/Illustra built on Postgres. • Informix Buys Illustra. (DataBlades) • Oracle Hires away Informix Programmers. (Cartridges)
Object Relational Data Model • Class, instance, attribute, method, and integrity constraints • OID per instance • Encapsulation • Multiple inheritance hierarchy of classes • Class references via OID object references • Set-Valued attributes • Abstract Data Types
Object Relational Extended SQL (Illustra) • CREATE TABLE tablename {OF TYPE Typename}|{OF NEW TYPE typename} (attr1 type1, attr2 type2,…,attrn typen) {UNDER parent_table_name}; • CREATE TYPE typename (attribute_name type_desc, attribute2 type2, …, attrn typen); • CREATE FUNCTION functionname (type_name, type_name) RETURNS type_name AS sql_statement
Object-Relational SQL in ORACLE • CREATE (OR REPLACE) TYPE typename AS OBJECT (attr_name, attr_type, …); • CREATE TABLE OF typename;
Example • CREATE TYPE ANIMAL_TY AS OBJECT (Breed VARCHAR2(25), Name VARCHAR2(25), Birthdate DATE); • Creates a new type • CREATE TABLE Animal of Animal_ty; • Creates “Object Table”
Constructor Functions • INSERT INTO Animal values (ANIMAL_TY(‘Mule’, ‘Frances’, TO_DATE(‘01-APR-1997’, ‘DD-MM-YYYY’))); • Insert a new ANIMAL_TY object into the table
Selecting from an Object Table • Just use the columns in the object… • SELECT Name from Animal;
More Complex Objects • CREATE TYPE Address_TY as object (Street VARCHAR2(50), City VARCHAR2(25), State CHAR(2), zip NUMBER); • CREATE TYPE Person_TY as object (Name VARCHAR2(25), Address ADDRESS_TY); • CREATE TABLE CUSTOMER (Customer_ID NUMBER, Person PERSON_TY);
What Does the Table Look like? • DESCRIBE CUSTOMER; • NAME TYPE • ----------------------------------------------------- • CUSTOMER_ID NUMBER • PERSON NAMED TYPE
Inserting • INSERT INTO CUSTOMER VALUES (1, PERSON_TY(‘John Smith’, ADDRESS_TY(‘57 Mt Pleasant St.’, ‘Finn’, ‘NH’, 111111)));
Selecting from Abstract Datatypes • SELECT Customer_ID from CUSTOMER; • SELECT * from CUSTOMER; CUSTOMER_ID PERSON(NAME, ADDRESS(STREET, CITY, STATE ZIP)) --------------------------------------------------------------------------------------------------- 1 PERSON_TY(‘JOHN SMITH’, ADDRESS_TY(‘57...
Selecting from Abstract Datatypes • SELECT Customer_id, person.name from Customer; • SELECT Customer_id, person.address.street from Customer;
Updating • UPDATE Customer SET person.address.city = ‘HART’ where person.address.city = ‘Briant’;
Functions • CREATE [OR REPLACE] FUNCTION funcname (argname [IN | OUT | IN OUT] datatype …) RETURN datatype (IS | AS) {block | external body}
Example Create Function BALANCE_CHECK (Person_name IN Varchar2) RETURN NUMBER is BALANCE NUMBER(10,2) BEGIN SELECT sum(decode(Action, ‘BOUGHT’, Amount, 0)) - sum(decode(Action, ‘SOLD’, amount, 0)) INTO BALANCE FROM LEDGER where Person = PERSON_NAME; RETURN BALANCE; END;
Example • Select NAME, BALANCE_CHECK(NAME) from Worker;
TRIGGERS • Create TRIGGER UPDATE_LODGING INSTEAD OF UPDATE on WORKER_LODGING for each row BEGIN • if :old.name <> :new.name then update worker set name = :new.name where name = :old.name; • end if; • if :old.lodging <> … etc...
Final Project Requirements Review Fourth Generation Languages PHP implementation Object-Relational Extensions to SQL Database Administration Lecture Outline
Today • Traditional and Current Data Administration • Traditional and Current Database Administration • Review of Security, Integrity, etc.
Changes in Traditional Roles • This is being driven by rapid changes in • Technology • Platforms (e.g., Micro vs. Mainframe vs. Server) • Organizational Structure • We will focus on the core functions and tasks of these roles (traditional or current)
Terms and Concepts (trad) • Data Administration • Responsibility for the overall management of data resources within an organization • Database Administration • Responsibility for physical database design and technical issues in database management • These roles are often combined or overlapping in some organizations
Terms and Concepts (trad) • DA • Data adminstrator - person responsible for the Data Administration function in an organization • Sometimes may be the CIO -- Chief Information Officer • DBA • Database Administrator - person responsible for the Database Administration Function
Database System Life Cycle Database Planning Database Analysis Growth & Change Operation & Maintenance Database Design Database Implementation Note: this is a different version of this life cycle than discussed previously
Database Planning • Development of a strategic plan for database development that supports the overall organization’s business plan • DA supports top management in development of this plan • The result of this stage is an enterprise data model
Database Planning: DA & DBA functions • Develop corporate database strategy (DA) • Develop enterprise model (DA) • Develop cost/benefit models (DA) • Design database environment (DA) • Develop data administration plan (DA)
Database Analysis • This is the process (discussed previously) of identifying data entities currently used by the organization, precisely defining those entities and their relationships, and documenting the results in a form that can support the follow-on design phase • Must also identify new data elements or changes to data elements that will be required in the future • The result of this phase is the Conceptual Data Model -- usually represented as an ER diagram
Database Analysis: DA & DBA functions • Define and model data requirements (DA) • Define and model business rules (DA) • Define operational requirements (DA) • Maintain corporate Data Dictionary (DA)
Database Design • Purpose of the design phase is the development of the logical database design that will serve the needs of the organization and the physical design implementing the logical design • In relational systems the outcome is normalized relations, and the data definition for a particular database systems (including indexes, etc.)
Design 2: Physical Creation • Development of the Physical Model of the Database • data formats and types • determination of indexes, etc. • Load a prototype database and test • Determine and implement security, privacy and access controls • Determine and implement integrity constraints
Database Design: DA &DBA functions • Perform logical database design (DA) • Design external models (subschemas) (DBA) • Design internal model (Physical design) (DBA) • Design integrity controls (DBA)
Database Implementation • Database design gives you an empty database • Load data into the database structure • Convert existing data sets and applications to use the new database • May need programs, conversion utilities to convert old data to new formats. • Outcome is the actual database with its data
Database Implementation DA & DBA functions • Specify database access policies (DA & DBA) • Establish Security controls (DBA) • Supervise Database loading (DBA) • Specify test procedures (DBA) • Develop application programming standards (DBA) • Establish procedures for backup and recovery (DBA) • Conduct User training (DA & DBA)
Operation and Maintenance 1: Operations • Users are responsible for updating the database, DA and DBA are responsible for developing procedures that ensure the integrity and security of the database during the update process. • Specific responsibility for data collection, editing and verification must be assigned • Quality assurance must be practiced to protect and audit the database quality.
Operation and Maintenance 2: Maintenance • The ongoing process of updating the database to keep it current • adding new records • deleting obsolete records • changing data values in particular records • modifying relation structures (e.g. adding new fields) • Privacy, security, access control must be in place. • Recovery and Backup procedures must be established and used
Operation and Maintenance: DA & DBA functions • Monitor database performance (DBA) • Tune and reorganize databases (DBA) • Enforce standards and procedures (DBA) • Support users (DA & DBA)
Growth & Change • Change is a way of life • Applications, data requirements, reports, etc. will all change as new needs and requirements are found • The Database and applications and will need to be modified to meet the needs of changes to the organization and the environment • Database performance should be monitored to maintain a high level of system performance