Database Flashcards
What is a database?
In simple terms, a database is a structured collection of data that is stored and organized in a computer system.
What does ERD stand for?
Entity relationship diagram
What is an ERD?
A visual representation that illustrates the relationships between entities (objects or concepts) in a database.
What is an entity?
An entity is a noun that defines one single thing
What notoation should you use for ERD’s?
Crows foot
What is another name for a record?
Tuple
What does DBMS stand for?
Database management system
What are the 2 main languages SQL is made up of
- Data Definition Language (DDL)
Data Manipulation Language (DML)
What is SQL
Structured Query Language, is a programming language used for managing and manipulating relational databases.
Describe Data Definition Language (DDL) and give examples
DDL commands define the structure of the database
* Allows the DBA or users to describe and name entities, attributes and relationships required for the applications that access it and associated integrity and security constraints.
Examples are :
CREATE TABLE, ALTER TABLE, DROP DATABASE, DROP TABLE, RENAME TABLE
Describe Data Manipulation Language (DML)
- DML is data manipulation language which is used for selecting, inserting, updating and deleting data in a database.
Example :
. SELECT
. INSERT
. UPDATE
. DELETE
What is a query ?
A query is code that interacts with the data base
Give some advantages of DBMS
- Data can be managed more easier
- Users can be provided with improved access to data
- Provides an integrated view of an enterprise’s operation
- The risk of inconsistency is improved
Security can be controlled
What is a constraint?
constraints are used to specify rules for the data in a table
Give an example of some constraints
UNIQUE, NOT NULL
What are the 4 types of relationships in a ERD?
. zero to many
. many to many
. 1 to 1
. 1 to many
What relationship do we prefe use in a relational database?
1 to many but we can represent others
What is a primary key?
A unique key to identify a record?
What is a foreign key ?
This is a field/attribute that provides a link between 2 tables. They are always at the many end of the relationship
What is a composite key?
It is a key made up of a primary and foreign key.
What is normalisation?
Normalisation is designing the best possible database with reduced data redundancy and best efficiency
What is data that has not been normalized called?
0NF (unormalised)
What must happen for first normal form (1NF)?
1.) It should only have single(atomic) valued attributes/columns.(1 value per field and no repeating data)
2.) Values stored in a column should be of the same domain(same data type)
3.) All the columns in a table should have unique names.
4.) The order in which data is stored, does not matter.
What must happen for second normal form (2NF) ?
- ) Be in 1NF
2.) Have no partial dependency