Database Management Systems (SQL/PL/SQL)

Similar documents
SQL - QUICK GUIDE. Allows users to access data in relational database management systems.

1 File Processing Systems

Oracle 10g PL/SQL Training

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: SQL and PL/SQL Fundamentals

Oracle SQL. Course Summary. Duration. Objectives

CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY

Triggers & Packages. {INSERT [OR] UPDATE [OR] DELETE}: This specifies the DML operation.

Oracle Database 10g: Introduction to SQL

Oracle Database: SQL and PL/SQL Fundamentals NEW

DATABASE MANAGEMENT SYSTEMS. Question Bank:

Database Programming with PL/SQL: Learning Objectives

Darshan Institute of Engineering & Technology PL_SQL

Database 10g Edition: All possible 10g features, either bundled or available at additional cost.

Oracle Database 12c: Introduction to SQL Ed 1.1

Maintaining Stored Procedures in Database Application

Chapter 2 Database System Concepts and Architecture

DATABASE MANAGEMENT SYSTEMS

ORACLE 9I / 10G / 11G / PL/SQL COURSE CONTENT

In This Lecture. SQL Data Definition SQL SQL. Notes. Non-Procedural Programming. Database Systems Lecture 5 Natasha Alechina

Oracle Database 10g: Program with PL/SQL

Oracle Database 10g Express

Introduction to Databases

SQL Data Definition. Database Systems Lecture 5 Natasha Alechina

1. INTRODUCTION TO RDBMS

Database Management System

Oracle Database: Introduction to SQL

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to:


Exploring Microsoft Office Access Chapter 2: Relational Databases and Multi-Table Queries

Duration Vendor Audience 5 Days Oracle End Users, Developers, Technical Consultants and Support Staff

Oracle Database: Introduction to SQL

Databases What the Specification Says

SQL Server for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach

Introduction to Database Systems

DBMS Questions. 3.) For which two constraints are indexes created when the constraint is added?

IT2305 Database Systems I (Compulsory)

What is a database? COSC 304 Introduction to Database Systems. Database Introduction. Example Problem. Databases in the Real-World

Database Systems. Lecture 1: Introduction

Intro to Embedded SQL Programming for ILE RPG Developers

VBA and Databases (see Chapter 14 )

ATTACHMENT 6 SQL Server 2012 Programming Standards

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. Introduction to Databases. Why databases? Why not use XML?

DATABASE SYSTEM CONCEPTS AND ARCHITECTURE CHAPTER 2

Oracle Database: Introduction to SQL

Oracle Database: Develop PL/SQL Program Units

BCA. Database Management System

Oracle Database: Program with PL/SQL

SQL Simple Queries. Chapter 3.1 V3.0. Napier University Dr Gordon Russell

David Dye. Extract, Transform, Load

Files. Files. Files. Files. Files. File Organisation. What s it all about? What s in a file?

14 Triggers / Embedded SQL

Oracle USF

Basic Concepts of Database Systems

SQL, PL/SQL FALL Semester 2013

5. CHANGING STRUCTURE AND DATA

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

Oracle For Beginners Page : 1

Chapter 1: Introduction. Database Management System (DBMS) University Database Example

Information Systems SQL. Nikolaj Popov

æ A collection of interrelated and persistent data èusually referred to as the database èdbèè.

Oracle(PL/SQL) Training

Fine Grained Auditing In Oracle 10G

Guide to SQL Programming: SQL:1999 and Oracle Rdb V7.1

Working with the Geodatabase Using SQL

How To Create A Table In Sql (Ahem)

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT. COURSE CURRICULUM COURSE TITLE: DATABASE MANAGEMENT (Code: ) Information Technology

Structured Query Language

IT2304: Database Systems 1 (DBS 1)

T-SQL STANDARD ELEMENTS

Basic Unix/Linux 1. Software Testing Interview Prep

Chapter 4. SQL Concepts & Facilities. Is SQL an End User Tool? AS/400 ANSI SQL Advanced Facilities

CSE 530A Database Management Systems. Introduction. Washington University Fall 2013

The first time through running an Ad Hoc query or Stored Procedure, SQL Server will go through each of the following steps.

CSE 233. Database System Overview

COURSE OUTLINE UCLA EXTENSI ON MGMNT X

Oracle Database 11g Express Edition PL/SQL and Database Administration Concepts -II

Chapter 1: Introduction

2874CD1EssentialSQL.qxd 6/25/01 3:06 PM Page 1 Essential SQL Copyright 2001 SYBEX, Inc., Alameda, CA

Oracle Database: Program with PL/SQL

Database Management. Chapter Objectives

A basic create statement for a simple student table would look like the following.

Database Management Systems

Oracle Database: Program with PL/SQL

AV-004: Administering and Programming with ORACLE

Performance Implications of Various Cursor Types in Microsoft SQL Server. By: Edward Whalen Performance Tuning Corporation

Oracle Database 11g SQL

Database Query 1: SQL Basics

ISM 318: Database Systems. Objectives. Database. Dr. Hamid R. Nemati

Oracle. Brief Course Content This course can be done in modular form as per the detail below. ORA-1 Oracle Database 10g: SQL 4 Weeks 4000/-

Relational Databases. Christopher Simpkins

Programming Database lectures for mathema

Oracle 11g PL/SQL training

A Brief Introduction to MySQL

The Relational Model. Why Study the Relational Model? Relational Database: Definitions. Chapter 3

ORACLE DATABASE 11G: COMPLETE

14 Databases. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

Chapter 1: Introduction

Transcription:

www.bankjobszone.com Database Management Systems (SQL/PL/SQL) Database Management System - Basic definitions and concepts In any organisation, the data is the most basic resource. To run the organisation efficiently, proper organisation and management of data is essential. Following are the formal definition of the major terms used in databases and database systems - Database A Database is a collection of interrelated data stored together with controlled redundancy to serve one or more applications in an optimal way. The data are stored in such a way that they are independent of the programs used by the people for accessing the data. The approach used in adding the new data, modifying and retrieving the existing data from the database is common and controlled one. The example of a database is a telephone directory that contains names, addresses and telephone numbers of the people stored in the computer storage. Databases are organised by fields, records and files. These are described briefly as follows: Fields It is the smallest unit of the data that has meaning to its users and is also called data item or data element. Name, Address and Telephone number are examples of fields. These are represented in the database by a value. Records A record is a collection of logically related fields and each field possesses a fixed number of bytes and is of fixed data type. Alternatively, we can say a record is one complete set of fields and each field has some value. The complete information about a particular phone number in the database represents a record. Records are of two types fixed length records and variable length records.

Files A file is a collection of related records. Generally, all the records in a file are of same size and record type, however, it is not always true. The records in a file may be of fixed length or variable length depending up on the size of the records contained in a file. The telephone directory containing records about the different telephone holders is an example of file. Database Management System (DBMS) DBMS is a program or group of programs that work in conjunction with the operating system to create, process, store, retrieve, control and manage the data. It acts as an interface between the application program and the data stored in the database. Alternatively, it can be defined as a computerised record-keeping system that stores information and allows the users to add, delete, modify, retrieve and update that information. The DBMS performs the following five primary functions: Define, Create and Organise a Database: The DBMS establishes the logical relationships among different data elements in a database and also defines schemas and sub schemas using the DDL. Input Data: It performs the function of entering the data into the database through an input device (like data screen, or voice activated system) with the help of the user. Process Data: It performs the function of manipulation and processing of the data stored in the database using the DML. Maintain Data Integrity and Security: It allows limited access of the database to authorised users to maintain data integrity and security. Query Database: It provides information to the decision makers that they need to make important decisions. This information is provided by querying the database using SQL.

Components of DBMS A DBMS has three main components. These are Data Definition Language (DDL), Data Manipulation Language and Query Facilities (DML/SQL) and software for controlled access of Database.

Data Definition Language (DDL) It allows the users to define the database, specify the data types, data structures and the constraints on the data to be stored in the database. Data Manipulation Language (DML) and Query Language DML allows users to insert, update, delete and retrieve data from the database. SQL provides general query facility. Software for Controlled Access of Database This software provides the facility of controlled access of the database by the users, concurrency control to allow shared access of the database and a recovery control system to restore the database in case of hardware or software failure. Meta Data A Meta data is the data about the data. The Meta data describe objects in the database and makes easier for those objects to be accessed or manipulated. The Meta data describes the database structure, sizes of data types, constraints, applications, authorisation etc., that are used as an integral tool for information resource management. Mainly, there are three types of Meta data: Descriptive Meta data: It describes a resource for purpose such as discovery and identification. In a traditional library cataloging that is form of Meta data, title, abstract; author and keywords are examples of Meta data. Structural Meta data: It describes how compound objects are put together. The example is how pages are ordered to form chapters. Administrative Meta data: It provides information to help manage a resource, such as when and how it was created, file type and other technical information, and who can access it. There are several subsets of data. Data Dictionary The data dictionary contains information of the data stored in the database and is consulted by the DBMS before any manipulation operation on the database. It is an integral part of the database management systems and store Meta Data i.e.,

information about the database, attribute names and definitions for each table in the database. It helps the DBA in the management of the database, user view definitions as well as their use. Data dictionary is generated for each database and generally stores and manages the following types of information: 1. The complete information about physical database design e.g. storage structures, access paths and file sizes etc. 2. The information about the database users, their responsibilities and access rights of each user. 3. The complete information about the schema of the database. 4. The high level descriptions of the database transactions, applications and the information about the relationships of users to the transactions. 5. The information about the relationship between the data items referenced by the database transactions. This information is helpful in determining which transactions are affected when some data definitions are modified. The data dictionaries are of two types Active Data Dictionary and Passive Data Dictionary. Active Data Dictionary: It is managed automatically by the database management system (DBMS) and is always consistent with the current structure and definition of the database. Most of the RDBMSes maintain active data dictionaries. Passive Data Dictionary: It is used only for documentation purposes and the data about fields, files and people are maintained into the dictionary for cross references. It is generally managed by the users of the system and is modified whenever the structure of the database is changed. The passive dictionary may not be consistent with the structure of the database, since modifications are performed manually by the user. It is possible that passive dictionaries may contain

information about organisation al data that is not computerized as these are maintained by the users. What is SQL? In 1971, IBM researchers created a simple non-procedural language called Structured English Query Language or SEQUEL. This was based on Dr. Edgar F. (Ted) Codd's design of a relational model for data storage where he described a universal programming language for accessing databases. In the late 80's ANSI and ISO (these are two organisations dealing with standards for a wide variety of things) came out with a standardized version called Structured Query Language or SQL. SQL is pronounced as 'Sequel'. There have been several versions of SQL and the latest one is SQL-99 though SQL-92 is the current universally adopted standard. SQL is the language used to query all databases. It's simple to learn and appears to do very little but is the heart of a successful database application. Understanding SQL and using it efficiently is highly imperative in designing an efficient database application. The better your understanding of SQL the more versatile you'll be in getting information out of databases. Onto SQL There are four basic commands which are the workhorses for SQL and figure in almost all queries to a database. INSERT - Insert Data DELETE - Delete Data SELECT - Pull Data UPDATE - Change existing Data As you can see SQL is like English. Let's build a real world example database using My SQL and perform some SQL operations on it. A database that practically anyone could use would be a Contacts database.

SQL Commands: Few SQL Coding Statements? Few of the SQL commands used in SQL code programming are: SELECT Statement, UPDATE Statement, INSERT INTO Statement, DELETE Statement, WHERE Clause, ORDER BY Clause, GROUP BY Clause, Sub query Clauses, Joins, Views, GROUP Functions, Indexes etc. Why SQL? Allows users to access data in relational database management systems. Allows users to describe the data. Allows users to define the data in database and manipulate that data. Allows embedding within other languages using SQL modules, libraries & precompilers. Allows users to create and drop databases and tables. Allows users to create view, stored procedure, functions in a database. Allows users to set permissions on tables, procedures, and views What is RDBMS? RDBMS stands for Relational Database Management System. RDBMS is the basis for SQL and for all modern database systems like MS SQL Server, IBM DB2, Oracle, My SQL, and Microsoft Access. A Relational database management system (RDBMS) is a database management system (DBMS) that is based on the relational model as introduced by E. F. Codd. What is table? The data in RDBMS is stored in database objects called tables. The table is a collection of related data entries and it consists of columns and rows. Remember, a table is the most common and simplest form of data storage in a relational database. What is field? Every table is broken up into smaller entities called fields. The fields in the CUSTOMERS table consist of ID, NAME, AGE, ADDRESS and SALARY. A field is a column in a table that is designed to maintain specific information about every record in the table.

What is record or row? A record, also called a row of data, is each individual entry that exists in a table. For example, there are 7 records in the above CUSTOMERS table. A record is a horizontal entity in a table. What is column? A column is a vertical entity in a table that contains all information associated with a specific field in a table. What is NULL value? A NULL value in a table is a value in a field that appears to be blank which means a field with a NULL value is a field with no value. It is very important to understand that a NULL value is different than a zero value or a field that contains spaces. A field with a NULL value is one that has been left blank during record creation. SQL Constraints: Constraints are the rules enforced on data columns on table. These are used to limit the type of data that can go into a table. This ensures the accuracy and reliability of the data in the database. Constraints could be column level or table level. Column level constraints are applied only to one column where as table level constraints are applied to the whole table. SQL Syntax: SQL is followed by unique set of rules and guidelines called Syntax. This tutorial gives you a quick start with SQL by listing all the basic SQL Syntax: All the SQL statements start with any of the keywords like SELECT, INSERT, UPDATE, DELETE, ALTER, DROP, CREATE, USE, SHOW and all the statements end with a semicolon (;). Important point to be noted is that SQL is case insensitive which means SELECT and select have same meaning in SQL statements but My SQL makes difference in

table names. So if you are working with My SQL then you need to give table names as they exist in the database. What is PL/SQL? PL/SQL stands for Procedural Language extension of SQL. PL/SQL is a combination of SQL along with the procedural features of programming languages. It was developed by Oracle Corporation in the early 90 s to enhance the capabilities of SQL. The PL/SQL Engine: Oracle uses a PL/SQL engine to processes the PL/SQL statements. A PL/SQL code can be stored in the client system (client-side) or in the database (server-side). A Simple PL/SQL Block: Each PL/SQL program consists of SQL and PL/SQL statements which from a PL/SQL block. PL/SQL Block consists of three sections: The Declaration section (optional). The Execution section (mandatory). The Exception (or Error) Handling section (optional). Declaration Section: The Declaration section of a PL/SQL Block starts with the reserved keyword DECLARE. This section is optional and is used to declare any placeholders like variables, constants, records and cursors, which are used to manipulate data in the execution section. Placeholders may be any of Variables, Constants and Records, which stores data temporarily. Cursors are also declared in this section. Execution Section: The Execution section of a PL/SQL Block starts with the reserved keyword BEGIN and ends with END. This is a mandatory section and is the section where

the program logic is written to perform any task. The programmatic constructs like loops, conditional statement and SQL statements form part of execution section. Exception Section: The Exception section of a PL/SQL Block starts with the reserved keyword EXCEPTION. This section is optional. Any errors in the program can be handled in this section, so that the PL/SQL Blocks terminates gracefully. If the PL/SQL Block contains exceptions that cannot be handled, the Block terminates abruptly with errors. Advantages of PL/SQL These are the Advantages of PL/SQL Block Structures: PL SQL consists of blocks of code, which can be nested within each other. Each block forms a unit of a task or a logical module. PL/SQL Blocks can be stored in the database and reused. Procedural Language Capability: PL SQL consists of procedural language constructs such as conditional statements (if else statements) and loops like (FOR loops). Better Performance: PL SQL engine processes multiple SQL statements simultaneously as a single block, thereby reducing network traffic. Error Handling: PL/SQL handles errors or exceptions effectively during the execution of a PL/SQL program. Once an exception is caught, specific actions can be taken depending upon the type of the exception or it can be displayed to the user with a message. Practice Questions 1. In an organisation, the is the most basic resource. Ans: Data 2. A database is a collection of data stored together.

Ans: Interrelated 3. Databases are organized by fields. Ans: Records and files 4. is the smallest unit of the data. Ans: Fields 5. A record is a collection of related fields. Ans: Logically 6. A file is a collection of. Ans: Related records 7. A DBMS has main components. Ans: Three 8. The data in RDBMS is stored in database objects called. Ans: Tables 9. A field is a column in a. Ans: Table 10. A record, also called a. Ans: Row of data 11. A Meta data is the about the data. Ans: Data 12. SQL is the language used to query all. Ans: Databases 13. PL/SQL stands for Procedural Language extension of. Ans: SQL

14. PL SQL consists of which can be nested within each other. Ans: Blocks of code 15. PL SQL consists of procedural language constructs such as. Ans: Conditional Statements 16. PL SQL engine processes multiple simultaneously. Ans: SQL Statements