Beruflich Dokumente
Kultur Dokumente
DBMS
A database management system (DBMS) refers to the technology for creating and managing
databases. DBMS is a software tool to organize (create, retrieve, update and manage) data in a
database.
ABOUT DBMS
The main aim of a DBMS is to supply a way to store up and retrieve database information that is
both convenient and efficient. By data, we mean known facts that can be recorded and that have
embedded meaning. Normally people use software such as DBASE IV or V, Microsoft ACCESS, or
EXCEL to store data in the form of database. A datum is a unit of data. Meaningful data combined to
form information. Hence, information is interpreted data - data provided with semantics. MS.
ACCESS is one of the most common examples of database management software.
Advantages of DBMS
A DBMS manage data and has many advantages. These are:
Data independence
Efficient data
Data administration
Components of DBMS
Users: Users may be of any kind such as DB administrator, System developer or database
users.
DBMS: Software that allows users to create and manipulate database access,
TYPES OF DBMS
Object relational database – Relational DBMS are evolving continuously and they
have been incorporating many concepts developed in object database leading to a new
class called extended relational database or object relational database.
Hierarchical database – In this, the information about the groups of parent or child
relationships is present in the records which is similar to the structure of a tree. Here the
data follows a series of records, set of values attached to it. They are used in industry on
mainframe platforms. Examples are IMS(IBM), Windows registry(Microsoft).
Network database – Mainly used on a large digital computers. If there are more
connections, then this database is efficient. They are similar to hierarchical database,
they look like a cobweb or interconnected network of records. Examples are CA-
IDMS(COMPUTER associates), IMAGE(HP).
OOPS CONCEPT
1) Class
The class is a group of similar entities. It is only an logical component and not the physical entity.
For example, if you had a class called “Expensive Cars” it could have objects like Mercedes, BMW,
Toyota, etc. Its properties(data) can be price or speed of these cars. While the methods may be
performed with these cars are driving, reverse, braking etc.
2) Object
An object can be defined as an instance of a class, and there can be multiple instances of a class in a
program. An Object contains both the data and the function, which operates on the data. For example
- chair, bike, marker, pen, table, car, etc.
3) Inheritance
Inheritance is an OOPS concept in which one object acquires the properties and behaviors of the
parent object. It’s creating a parent-child relationship between two classes. It offers robust and
natural mechanism for organizing and structure of any software.
4) Polymorphism
Polymorphism refers to the ability of a variable, object or function to take on multiple forms. For
example, in English, the verb run has a different meaning if you use it with a laptop, a foot race,
and business. Here, we understand the meaning of run based on the other words used along with
it.The same also applied to Polymorphism.
5) Abstraction
6) Encapsulation
Encapsulation is an OOP technique of wrapping the data and code. In this OOPS concept, the
variables of a class are always hidden from other classes. It can only be accessed using the methods
of their current class. For example - in school, a student cannot exist without a class.
CODDS RULE
Dr. Edgar Frank Codd (August 19, 1923 – April 18, 2003) was a computer scientist
while working for IBM he invented the relational model for database management (
theoretical basis for relational databases). Codd proposed thirteen rules (numbered
zero to twelve) and said that if a Database Management System meets these rules,
it can be called as a Relational Database Management System. These rules are
called as Codd's12 rules.
Rule Zero
The system must qualify as relational, as a database, and as a management system. For a
system to qualify as a relational database management system (RDBMS), that system must use
its relational facilities (exclusively) to manage the database.
The other 12 rules derive from this rule. The rules are as follows :
Each attribute must contain only a single value from its pre-defined domain.
We broke the relation in two as depicted in the above picture. So there exists no partial
dependency.
We find that in the above Student_detail relation, Stu_ID is the key and only prime key
attribute. We find that City can be identified by Stu_ID as well as Zip itself. Neither Zip is a
superkey nor is City a prime attribute. Additionally, Stu_ID → Zip → City, so there
exists transitive dependency.
To bring this relation into third normal form, we break the relation into two relations as
follows −
Boyce-Codd Normal Form
Boyce-Codd Normal Form (BCNF) is an extension of Third Normal Form on strict terms.
BCNF states that −
Predefined PL/SQL data types are grouped into composite, LOB, reference, and
scalar type categories.
A LOB type holds values, called lob locators, that specify the location of
large objects, such as text blocks or graphic images, that are stored
separately from other database data. LOB types include BFILE, BLOB,
CLOB, and NCLOB.
A reference type holds values, called pointers, that designate other program
items. These types include REF CURSORS and REFs to object types.
2. PL/SQL Character and String Types and PL/SQL National Character Types
CHAR, CHARACTER, LONG, LONG RAW, NCHAR, NVARCHAR2, RAW,
ROWID, STRING, UROWID, VARCHAR, VARCHAR2 Note that the LONG
and LONG RAW data types are supported only for backward
compatibility Information.
DATE
TIMESTAMP
TIMESTAMP WITH TIME ZONE
TIMESTAMP WITH LOCAL TIME ZONE
The Interval data types are −
MONTH 01 to 12 0 to 11
HOUR 00 to 23 0 to 23
MINUTE 00 to 59 0 to 59
DATE
It stores date and time information in both character and number datatypes. It is made of
information on century, year, month, date, hour, minute, and second. It is specified as −
TIMESTAMP
It is an extension of the DATE data type. It stores the year, month, and day of the DATE
datatype, along with hour, minute, and second values. It is useful for storing precise time
values.
TIMESTAMP WITH TIME ZONE
It is a variant of TIMESTAMP that includes a time zone region name or a time zone offset
in its value. The time zone offset is the difference (in hours and minutes) between local
time and UTC. This data type is useful for collecting and evaluating date information
across geographic regions.
1 ADD_MONTHS(x, y);
Adds y months to x.
2 LAST_DAY(x);
Returns the last day of the month.
3 MONTHS_BETWEEN(x, y);
Returns the number of months between x and y.
4 NEXT_DAY(x, day);
Returns the datetime of the next day after x.
5 NEW_TIME;
Returns the time/day value from a time zone specified by the user.
6 ROUND(x [, unit]);
Rounds x.
7 SYSDATE();
Returns the current datetime.
8 TRUNC(x [, unit]);
Truncates x.
Timestamp functions (where, x has a timestamp value) −
CURRENT_TIMESTAMP();
1
Returns a TIMESTAMP WITH TIME ZONE containing the current session time along with
the session time zone.
FROM_TZ(x, time_zone);
3
Converts the TIMESTAMP x and the time zone specified by time_zone to a TIMESTAMP
WITH TIMEZONE.
4 LOCALTIMESTAMP();
Returns a TIMESTAMP containing the local time in the session time zone.
SYSTIMESTAMP();
5
Returns a TIMESTAMP WITH TIME ZONE containing the current database time along with
the database time zone.
SYS_EXTRACT_UTC(x);
6
Converts the TIMESTAMP WITH TIMEZONE x to a TIMESTAMP containing the date and
time in UTC.
7 TO_TIMESTAMP(x, [format]);
Converts the string x to a TIMESTAMP.
8 TO_TIMESTAMP_TZ(x, [format]);
Converts the string x to a TIMESTAMP WITH TIMEZONE.
The Interval Data Types and Functions
Following are the Interval data types −
IINTERVAL YEAR TO MONTH − It stores a period of time using the YEAR and MONTH
datetime fields.
INTERVAL DAY TO SECOND − It stores a period of time in terms of days, hours, minutes, and
seconds.
Interval Functions
S.No Function Name & Description
1 NUMTODSINTERVAL(x, interval_unit);
Converts the number x to an INTERVAL DAY TO SECOND.
2 NUMTOYMINTERVAL(x, interval_unit);
Converts the number x to an INTERVAL YEAR TO MONTH.
3 TO_DSINTERVAL(x);
Converts the string x to an INTERVAL DAY TO SECOND.
4 TO_YMINTERVAL(x);
Converts the string x to an INTERVAL YEAR TO MONTH