Académique Documents
Professionnel Documents
Culture Documents
Ans:- A DBMS is a set of software programs that controls the organization, storage,
management, and retrieval of data in a database. DBMSs are categorized according to
their data structures or types. The DBMS accepts requests for data from an application
program and instructs the operating system to transfer the appropriate data. The queries
and responses must be submitted and received according to a format that conforms to one
or more applicable protocols. When a DBMS is used, information systems can be
changed more easily as the organization's information requirements change. New
categories of data can be added to the database without disruption to the existing system.
Advantages of a DBMS:-
select
customer_name
from
customer
where
customer_state = ‘New Mexico’;
An index scan is faster for this query if the percentage of customers in New Mexico is small
and the values are clustered on the data blocks. The decision to use an index versus a full-
table scan is at least partially determined by the percentage of customers in New Mexico.
So, why would a CBO choose to perform a full-table scan when only a small number of rows
are retrieved? The clustering_factor has the answer.
Four factors synchronize to help the CBO choose whether to use an index or a full-table scan:
the selectivity of a column value; the db_block_size ; the avg_row_len ; and the cardinality.
An index scan is usually faster if a data column has high selectivity and a low
clustering_factor.
This section describes the rules that can be applied to table columns to enforce different types of
data integrity.
Null Rule
A null is a rule defined on a single column that allows or disallows inserts or updates of rows
containing a null (the absence of a value) in that column.
A unique value defined on a column (or set of columns) allows the insert or update of a row only
if it contains a unique value in that column (or set of columns).
A primary key value defined on a key (a column or set of columns) specifies that each row in the
table can be uniquely identified by the values in the key.
A rule defined on a key (a column or set of columns) in one table that guarantees that the values
in that key match the values in a key in a related table (the referenced value).Referential integrity
also includes the rules that dictate what types of data manipulation are allowed on referenced
values and how these actions affect dependent values. The rules associated with referential
integrity are:
Complex integrity checking is a user-defined rule for a column (or set of columns) that allows or
disallows inserts, updates, or deletes of a row based on the value it contains for the column (or set
of columns).
An integrity constraint is a declarative method of defining a rule for a column of a table. Oracle
supports the following integrity constraints:
• NOT NULL constraints for the rules associated with nulls in a column
• UNIQUE key constraints for the rule associated with unique column values
• PRIMARY KEY constraints for the rule associated with primary identification values
• FOREIGN KEY constraints for the rules associated with referential integrity. Oracle
supports the use of FOREIGN KEY integrity constraints to define the referential integrity
actions, including:
o Update and delete No Action
o Delete CASCADE
o Delete SET NULL
Ans:- Data are actually stored as bits, or numbers and strings, but it is difficult to work
with data at this level.
Schema:
• Description of data at some level. Each level has its own schema.
• physical,
• conceptual, and
• external.
5. Describe the relational algebra operations with relevant real time examples.
Ans:- n order to implement a DBMS, there must exist a set of rules which state how
the database system will behave. For instance, somewhere in the DBMS must be a set of
statements which indicate than when someone inserts data into a row of a relation, it has
the effect which the user expects. One way to specify this is to use words to write an
`essay' as to how the DBMS will operate, but words tend to be imprecise and open to
interpretation. Instead, relational databases are more usually defined using Relational
Algebra.
Relational Algebra is :
Operators in relational algebra are not necessarily the same as SQL operators, even if
they have the same name. For example, the SELECT statement exists in SQL, and also
exists in relational algebra. These two uses of SELECT are not the same. The DBMS
must take whatever SQL statements the user types in and translate them into relational
algebra operations before applying them to the database.
R × S = {(r1, r2, ..., rn, s1, s2, ..., sm) | (r1, r2, ..., rn) ∈ R, (s1, s2, ..., sm) ∈ S}
R S = { t : t R, s S, Fun (t s) }
• An entity is any object in the system that we want to model and store information
about
• Individual objects are called entities
• Groups of the same type of objects are called entity types or entity sets
• Entities are represented by rectangles (either with round or square corners)
Attribute:-
8. Explain the following database operations with one query example for each:
• INSERT INTO table (column1, [column2, ... ]) VALUES (value1, [value2, ...])
The number of columns and values must be the same. If a column is not specified, the
default value for the column is used. The values specified (or implied) by the INSERT
statement must satisfy all the applicable constraints (such as primary keys, CHECK
constraints, and NOT NULL constraints). If a syntax error occurs or if any constraints are
violated, the new row is not added to the table and an error returned instead.
Example:
INSERT INTO phone_book (name, number) VALUES ('John Doe', '555-1212');
Any rows that match the WHERE condition will be removed from the table. If the WHERE
clause is omitted, all rows in the table are removed. The DELETE statement does not return
any rows; that is, it will not generate a result set.
Executing a DELETE statement can cause triggers to run that can cause deletes in other
tables. For example, if two tables are linked by a foreign key and rows in the referenced
table are deleted, then it is common that rows in the referencing table would also have to
be deleted to maintain referential integrity.
c) Update:- An SQL UPDATE statement changes the data of one or more records in a table.
Either all the rows can be updated, or a subset may be chosen using a condition.
For the UPDATE to be successful, the user must have data manipulation privileges (UPDATE
privilege) on the table or column, the updated value must not conflict with all the applicable
constraints (such as primary keys, unique indexes, CHECK constraints, and NOT NULL
constraints).
Set the value of column C1 in table T to 1, only in those rows where the value of column
C2 is "a".
a)Third Normal Form:- The normal forms (abbrev. NF) of relational database theory provide
criteria for determining a table's degree of vulnerability to logical inconsistencies and anomalies.
The higher the normal form applicable to a table, the less vulnerable it is to inconsistencies and
anomalies. Each table has a "highest normal form" (HNF): by definition, a table always meets the
requirements of its HNF and of all normal forms lower than its HNF; also by definition, a table
fails to meet the requirements of any normal form higher than its HNF.
The normal forms are applicable to individual tables; to say that an entire database is in normal
form n is to say that all of its tables are in normal form.Every non-prime attribute is non-
transitively dependent on every candidate key in the table.
SQL Syntax
SQL supports discretionary access control through the GRANT and REVOKE
commands.
The GRANT command gives users privileges to base tables and views.
of [0, |K|-1].
Public Key Infrastructure (PKI) is a set of hardware, software, people, policies, and procedures
needed to create, manage, distribute, use, store, and revoke digital certificates.[1] In cryptography,
a PKI is an arrangement that binds public keys with respective user identities by means of a
certificate authority (CA). The user identity must be unique within each CA domain. The binding
is established through the registration and issuance process, which, depending on the level of
assurance the binding has, may be carried out by software at a CA, or under human supervision.
The PKI role that assures this binding is called the Registration Authority (RA). For each user,
the user identity, the public key, their binding, validity conditions and other attributes are made
unforgettable in public key certificates issued by the CA.
The term trusted third party (TTP) may also be used for certificate authority (CA). The term PKI
is sometimes erroneously used to denote public key algorithms, which do not require the use of a
CA.
I plan to be experimenting with IUS in some heavily accessed sites during the latter
portion of 1997. I'm going to record my experiences here and hope to have lots of tips
and source code to distribute.
All subsequent explanations on join types in this article make use of the following two tables. The
rows in these tables serve to illustrate the effect of different types of joins and join-predicates. In
the following tables the DepartmentID column of the Department table (which can be
designated as Department.DepartmentID) is the primary key, while
Employee.DepartmentID is a foreign key.
c. Distinct and Eliminating Duplicates:- every field in one record is identical to every field
in a different record, i.e. a duplicate is where there is no way of telling two or more records apart.
If you just need to remove records which are similar (i.e. one or more fields are identical but there
are one or more fields which are different) then instead refer to how to delete similar records.
To check that you have duplicate records in your table do the following:
and
Unfortunately there is no way in SQL to delete one of these duplicates without deleting all of
them. They are identical after all, so there is no SQL query that you could put together which
could distinguish between them.
What you can do is to copy all the distinct records into a new table:
select distinct *
into NewTable
from MyTable
This query will create a new table (NewTable in my example) containing all the records in the
original table but without any records being duplicated. It will therefore preserve a single copy of
those records which were duplicated.
Ans:- Concurrency control in Database management systems (DBMS; Bernstein et al. 1987,
Weikum and Vossen 2001), other transactional objects, and related distributed applications (e.g.,
Grid computing and Cloud computing) ensures that database transactions are performed
concurrently without violating the data integrity of the respective databases. Thus concurrency
control is an essential element for correctness in any system where two database transactions or
more, executed with time overlap, can access the same data, e.g., virtually in any general-purpose
database system. A well established concurrency control theory exists for database systems:
serializability theory, which allows to effectively design and analyze concurrency control
methods and mechanisms.
To ensure correctness, A DBMS usually guarantees that only serializable transaction schedules
are generated, unless serializability is intentionally relaxed. For maintaining correctness in cases
of failed (aborted) transactions (which can always happen for many reasons) schedules also need
to have the recoverability property. A DBMS also guarantees that no effect of committed
transactions is lost, and no effect of aborted (rolled back) transactions remains in the related
database. Overall transaction characterization is usually summarized by the following ACID
rules.
b) Heap Files:- Rows are simply appended to the end of the file as they are inserted.
Hence the file is unordered.
Deleted rows will create gaps in file. File then must be periodically compacted to recover
space.
Inserting a row:
Updating a row:
Deleting a row: