11. databases and software development Flashcards
entity
is a category of object, person, event or thing of interest to an organisation about which data is to be recorded
attributes
a characteristic specification that defines a property or feature about an entity stored in a database
entity relationship modelling
a method of abstractly describing the data tables and the relationships between them visually. they can be used to reduce redundancy and construct a relational database.
entity identifier
uniquely identifies the entity e.g. primary key
primary key
a unique identifier that identifies each record in a table. the primary key is underlined.
relational databases
a database where separate tables are made for each entity, and relationships between entities are represented by foreign keys
foreign key
a linking attribute that joins two tables in a relational database by being a primary key in one and a foreign key in the other
relationships between entities
- one-to-one
- one-to-many
- many-to-many
relational database (TB).
is a collection of tables in which relationships are modelled by shared attributes
normalisation
is a process used to come up with the best possible design for a relational database.
tables should be organised in such a way that
- no data is unnecessarily duplicated
- data is consistent throughout the database
- the structure of each table is flexible enough to allow you to enter as many or as few items as required
- the structure should enable a user to make all kinds of complex queries relating data from different tables
first normal form
contains no repeating attribute or groups pf attributes
second normal form
if the table is in 1NF and contains no partial dependencies
partial dependency
one or more of the attributes depends on only part of the primary key, which can only occur of the primary key is a composite key
composite key
a primary key made up from two or more other keys
third normal form
all attributes are dependent on the key, the whole key and nothing but the key
the importance of normalisation
- easier to maintain and change a normalised database
- data integrity is maintained since there is no unnecessary duplication of data
- produce smaller tables with fewer fields, this results in faster searching and indexing operations as there is less data involved
- will not allow records in a table on the ‘one’ side of one-to-many relationship to be deleted accidently. this will prevent accidental deletion
SQL
structured query language is a declarative language used for querying and updating tables in a relational database
SELECT..FROM..WHERE
the SELECT statement is used to extract a collection of fields from a given table. the basic syntax of this statement is
SELECT list of fields to be displayed
FROM list the table or tables the data will come from
WHERE list of search criteria
ORDER BY list the fields that the results are to be stored on (default is ascending order)
CREATE A NEW DATABASE TABLE
e.g.
CREATE TABLE employee
(
EmpID INTEGER NOT NULL PRIMARY KEY
EmpName VARCHAR (20) NOT FULL,
HireDate DATE,
Salary CURRENCY
)
ALTERING A TABLE STRUCTURE
page 337-338 TB
client-server database
a system that provides simultaneous access to the database for multiple clients
advantages of client-server database
- the consistency is maintained because only one copy of the data is held (on the server) rather than a copy at each workstation
- an expensive resource (powerful computer and large database) can be made available to a large number of users
- access rights and security can be managed and controlled centrally
- backup and recovery can be managed centrally
potential problems with client-server database
- allowing multiple users to simultaneously update table may cause one of the updates to be lost unless measures are taken to prevent this
- when an item is updated, the entire record (indeed the whole block in which the record is physically held) will be copied into the user’s own local memory area at the work station. when the record is saved, the block is written to the file server.