Академический Документы
Профессиональный Документы
Культура Документы
Data models can be represented by an accompanying database diagram. Data models are
represented by the data modeling notation, which is often presented in the graphical format. Their main focus
is to support and aid information systems by showing the format and definition of the different data involved.
They also help prevent data redundancy. Information stored in data models is of great significance for
businesses because it dictates the relationships between database tables, foreign keys and the events involved.
Conceptual data models- High-level, static business structures and concepts. The business key,
attributes and definitions of business data objects. Also shows the relationship between business
data objects. Broader scope than LDM and may cover a subject area (also known as subject area
model).
Physical data models- Entity types, data attributes and relationships between entities. Technical design
e.g. tables, columns, keys, foreign keys and other constraints to be implemented in the data base
or XSD. May be generated from a logical data model. This model is within the scope of a defined
project.
Logical data models- The internal schema database design. Documents the business key, attributes
and definitions of business data objects. It also shows the relationship between business data
objects. Frequently is within the scope of a defined project.
Data models are used for many purposes, from high-level conceptual models to physical data models. Data
modeling explores data-oriented structures and identifies entity types. The purpose of a Data model is to
design a relational database system An ER Model is used to specify design and document
Database design A Data model is a pictorial representation of the structure of a relational
database system it is a description of the objects represented by a computer system
together with their properties and relationships ER Modelling is a Database design method
Concurrency control is a database management systems (DBMS) concept that is used to address conflicts
with the simultaneous accessing or altering of data that can occur with a multi-user system. concurrency
control, when applied to a DBMS, is meant to coordinate simultaneous transactions while preserving data
integrity. The Concurrency is about to control the multi-user access of Database.
2
Pessimistic Locking: This concurrency control strategy involves keeping an entity in a database locked the
entire time it exists in the database's memory. This limits or prevents users from altering the data entity
that is locked. There are two types of locks that fall under the category of pessimistic locking: write lock
and read lock.
With write lock, everyone but the holder of the lock is prevented from reading, updating, or deleting the
entity. With read lock, other users can read the entity, but no one except for the lock holder can update or
delete it.
Optimistic Locking: This strategy can be used when instances of simultaneous transactions, or collisions,
are expected to be infrequent. In contrast with pessimistic locking, optimistic locking doesn't try to
prevent the collisions from occurring. Instead, it aims to detect these collisions and resolve them on the
chance occasions when they occur.
Pessimistic locking provides a guarantee that database changes are made safely. However, it becomes less
viable as the number of simultaneous users or the number of entities involved in a transaction increase
because the potential for having to wait for a lock to release will increase.
Optimistic locking can alleviate the problem of waiting for locks to release, but then users have the
potential to experience collisions when attempting to update the database.
A database software is system software for creating and managing databases. The DBMS provides users and
programmers with a systematic way to create, retrieve, update and manage data.
Relational database management system (RDMS) - adaptable to most use cases, but RDBMS Tier-1 products
can be quite expensive.
NoSQL DBMS - well-suited for loosely defined data structures that may evolve over time.
In-memory database management system (IMDBMS) - provides faster response times and better performance.
Columnar database management system (CDBMS) - well-suited for data warehouses that have a large number
of similar data items.
Cloud-based data management system - the cloud service provider is responsible for providing and
maintaining the DBMS.
Some examples of database software are Oracle, FileMaker Pro, Microsoft Access, Microsoft SQL Server,
SAP and MySQL. Database software, also called a database management system or DBMS, is used to store,
retrieve, add, delete and modify data.
7. Describe DDL.
Data Definition Language (DDL) is a standard for commands that define the different structures in a database.
DDL statements create, modify, and remove database objects such as tables, indexes, and users. Common DDL
statements are CREATE, ALTER, and DROP.
DDL statements are used to build and modify the structure of your tables and other objects in
the database. When you execute a DDL statement, it takes effect immediately.
The create table statement does exactly that:
CREATE TABLE <table name> (
<attribute name 1> <data type 1>,
...
<attribute name n> <data type n>);
The data types that you will use most frequently are character strings, which might be
called VARCHAR or CHAR for variable or fixed length strings; numeric types such as
NUMBER or INTEGER, which will usually specify a precision; and DATE or related types.
Data type syntax is variable from system to system; the only way to be sure is to consult
the documentation for your own software.
The alter table statement may be used as you have seen to specify primary and foreign key
constraints, as well as to make other modifications to the table structure. Key constraints may
also be specified in the CREATE TABLE statement.
ALTER TABLE <table name>
ADD CONSTRAINT <constraint name> PRIMARY KEY (<attribute list>);
You get to specify the constraint name. Get used to following a convention of
tablename_pk (for example, Customers_pk), so you can remember what you did later. The
attribute list contains the one or more attributes that form this PK; if more than one, the
names are separated by commas.
The foreign key constraint is a bit more complicated, since we have to specify both the FK
attributes in this (child) table, and the PK attributes that they link to in the parent table.
ALTER TABLE <table name>
ADD CONSTRAINT <constraint name> FOREIGN KEY (<attribute list>)
4
Database security concerns the use of a broad range of information security controls to protect
databases (potentially including the data, the database applications or stored functions, the
database systems, the database servers and the associated network links) against compromises of
their confidentiality, integrity and availability. It involves various types or categories of controls,
such as technical, procedural/administrative and physical.
Legal issues
Physical security
OS/Network security
Database security can be defined as a system or process by which the "Confidentiality, Integrity, and
Availability," or CIA, of the database can be protected. Unauthorized entry or access to a database server
signifies a loss of confidentiality; unauthorized alteration to the available data signifies loss of integrity;
5
and lack of access to database services signifies loss of availability. Loss of one or more of these basic
facets will have a significant impact on the security of the database.
Databases have been largely secured against hackers through network security measures such as firewalls, and
network-based intrusion detection systems. While network security controls remain valuable in this regard,
securing the database systems themselves, and the programs/functions and data within them, has arguably
become more critical as networks are increasingly opened to wider access, in particular access from the
Internet. Furthermore, system, program, function and data access controls, along with the associated user
identification, authentication and rights management functions, have always been important to limit and in
some cases log the activities of authorized users and administrators.
In this data model, the entities are represented in a hierarchical fashion. Here we identify a parent entity,
and its child entity. Again we drill down to identify next level of child entity and so on. This model can be
imagined as folders inside a folder!
6
Primary Key Constraints- Primary key is the term used to identify one or more columns
in a table that make a row of data unique. Although the primary key typically consists of one
column in a table, more than one column can comprise the primary key. The primary key is
assigned at table creation. The following example identifies the EMP_ID column as the PRIMARY
KEY for the EMPLOYEES table:
Unique Constraints - A unique column constraint in a table is similar to a primary key in that the value
in that column for every row of data in the table must have a unique value. Although a primary key
constraint is placed on one column, you can place a unique constraint on another column even though it is
not actually for use as the primary key.
Study the following example:
CREATE TABLE EMPLOYEE_TBL
(EMP_ID CHAR(9) NOT NULL PRIMARY KEY,
EMP_NAME VARCHAR (40) NOT NULL,
EMP_ST_ADDR VARCHAR (20) NOT NULL,
EMP_CITY VARCHAR (15) NOT NULL,
EMP_PHONE INTEGER(10) NULL UNIQUE,
EMP_PAGER INTEGER(10) NULL);
Foreign Key Constraints - A foreign key is a column in a child table that references a primary key in the
parent table. A foreign key constraint is the main mechanism used to enforce referential integrity between
tables in a relational database. A column defined as a foreign key is used to reference a column defined as
a primary key in another table.
Check Constraints - Check (CHK) constraints can be utilized to check the validity of data entered into
particular table columns. Check constraints are used to provide back-end database edits, although edits
are commonly found in the front-end application as well. General edits restrict values that can be entered
into columns or objects, whether within the database itself or on a front-end application. The check
constraint is a way of providing another protective layer for the data.
Table altered.
DML statements affect records in a table. These are basic operations we perform on
data such as selecting a few records from a table, inserting new records, deleting
unnecessary records, and updating/modifying existing records.
SELECT Command - Once the data has been inserted into a table,the next most logical
operation would be to view what has been inserted. The SELECT SQL verb is used to
achieve this.The SELECT command is used to retrieve rows selected from one or more
tables.
All Rows And All Columns In order to view global data the syntax is:
Or
For example:
9
101 sushil 39
1) INSERT command - Insert command is used to insert data into a table. Following is its
general syntax,
101 sushil 39
Delete command- Delete command is used to delete data from a table. Delete command
can also be used with condition to delete a particular row. Following is its general syntax,
The above command will delete all the records from Student table.
17:
Every book has a title, isbn, year and price. The store also keeps the author and
publisher for any book.
For authors, the database keeps the name, address and the url of their homepage.
For publishers, the database keeps the name, address, phone number and the url of
their website.
The store has several warehouses, each of which has a code, address and phone
number.
warehouses. (In previous sentence, we are not referring to a particular copy of the
book. Consider for example the complete book for our course. This book may be
stocked at multiple warehouses.)
warehouses.
The bookstore keeps the name, address, email-id, and phone number of its
customers.
Design an ER diagram for such a bookstore. You are NOT required to identify keys
or constraints for this problem.
11
Answer
STEP 1
Identify all the entities
-AUTHOR
-PUBLISHER
-BOOK
-CUSTOMER
-SHOPPING_BASKET
-WAREHOUSE
STEP 2
find the relations
1.Each book is written by a author
2.Each book has a publisher
3. Some shopping baskets may contain more than one copy of same book
4. The warehouse stocks several books
5. A customer owns several shopping basket
STEP 3
Identify the key attribute
*AUTHOR- name
*PUBLISHER- name
*BOOK- ISBN
*CUSTOMER- email
*SHOPPING_BASKET- basket_ID
*WAREHOUSE- code
STEP 4
Identify other relevant attributes
*AUTHOR- name,address,URL
*PUBLISHER- name,address,URL,phone
*BOOK- ISBN,year,title,price
*CUSTOMER- email, name,address,phone
*SHOPPING_BASKET- basket_ID
*WAREHOUSE- code, address,phone